Compilation 2012 Domain-Specific Languages and Syntax Extensions

Size: px
Start display at page:

Download "Compilation 2012 Domain-Specific Languages and Syntax Extensions"

Transcription

1 Compilation 2012 and Syntax Extensions Jan Midtgaard Michael I. Schwartzbach Aarhus University

2 GPL Problem Solving The General Purpose Language (GPL) approach: analyze the problem domain express the conceptual model as an OO/FP/ design program a framework/library express concrete application as framework/library client Pros: predictable and familiar result (relatively) low cost of implementation Cons: difficult to fully exploit domain-specific knowledge only available to general programmers 2

3 DSL Problem Solving The DSL approach: analyze the problem domain express the conceptual model as a language design implement a compiler or interpreter Pros: possible to exploit all domain-specific knowledge also available to domain experts Cons: (relatively) high cost of implementation risk of Babylonian confusion lack of tool support (IDE, ) hard to combine DSLs or DSL and GPL this way 3

4 Variations of DSLs A stand-alone DSL: a novel language with unique syntax and features example: LaTeX An embedded DSL: an existing GPL extended with DSL features example: JSP An external DSL: a stand-alone DSL invoked from a GPL example: SQL invoked from Java (JDBC) 4

5 From DSL to GPL A stand-alone DSL may evolve into a GPL: Fortran Formula Translation Algol Algorithmic Language Cobol Common Business Oriented Language Lisp List Processing Language Simula Simulation Language ML Meta Language A (successful) DSL design should plan for growth 5

6 Using Domain-Specific Knowledge Domain-specific syntax: domain-specific syntax clarifies the behavior directly denote high-level concepts Domain-specific analysis: consider global properties of the application Domain-specific optimization: exploit domain-specific analysis results GPL frameworks cannot provide these benefits 6

7 The Ocamlyacc/Menhir Languages A stand-alone (or external) DSL: no general-purpose computing is required Domain concepts: Context-free grammars Tokens / terminals Non-terminals and productions Implemented using: a lexer+parser (hand-written or ocamllex/ocamlyacc) a symbol checker + analysis a parsetable builder + emitter (menhir contains different table/code/coq backends) 7

8 DSL Syntax for Grammars start : start PLUS term { } start MINUS term { } term { }; term : term STAR factor { } term SLASH factor { } factor { }; factor : ID { } LPAR start RPAR { }; The BNF syntax closely matches the domain at hand 8

9 GPL Alternatives Parsing can be done in a number of ways: Hand-written (lexer and) parser (more next week) Hand-written parser table Parser combinators Harder to write correctly Fixed implementation strategy In contrast (OCaml)yacc and menhir decouple the language description from the workings of the language parser 9

10 DSL Analysis for Grammars Symbol checking: Checks non-terminal and terminal names Checks indexes ($1) for validity (bounds + data) Menhir also type checks the productions (by type checking the action code) Analyses grammar for useless productions (reachability) and removes them Checks grammar for LALR/LR(1) conformance These are checked by phases in the ocamlyacc/menhir compiler 10

11 GPL Analysis Alternative Lots of yellow PostIt notes: These cannot (all) be checked by a GPL compiler, e.g., OCaml or Java. 11

12 The JWIG Language An embedded DSL (in Java): lots of general-purpose computing is required Domain concepts: XML templates Web services sessions Implemented using: a syntax extension a static analysis a framework 12

13 DSL Syntax for JWIG public class test extends Service { } String userid; public class Login extends Session { XML wrap = [[<html> <body bgcolor="yellow"> <[contents]> </body> </html>]]; public void main() { XML login = [[<form> Userid: <input type="text" name="userid"> <input type="submit"/> </form>]]; show wrap<[contents = login]; userid = receive userid; show wrap<[contents = "Welcome "+userid]; } } 13

14 GPL Syntax Alternative XML login = XML.make("<form>\nUserid: <input type=\"text\" name=\"userid\">\n<input type=\"submit\"/>\</form>"); show(wrap.plug("contents",login)); userid = receive("userid"); The DSL syntax maps directly to methods calls in an underlying Java framework Avoiding escapes makes the syntax more legible But this is just a thin layer of syntactic sugar 14

15 DSL Analysis for JWIG A static analysis that at compile time guarantees: only well-formed and valid XML is ever generated only existing form fields are ever received only exisiting gaps are ever plugged This is a DSL analysis that is performed on the resulting compiled class files 15

16 JWIG Implementation Model JWIG syntax jwigc Java syntax javac.class files jwiga JWIG framework analysis results 16

17 Syntax Extensions Programmers may want to extend the syntax of their programming language: introduce domain-specific syntax abbreviate common idioms define language extensions ensure consistency Such extensions are introduced through macros 17

18 Macros Macros are as old as programming Is used as an orthogonal abstraction mechanism Two different flavors: lexical macros syntactic macros Main Entry: 2 macro Pronunciation: 'ma-(")kro Function: noun Inflected Form(s): plural macros Etymology: short for macroinstruction Date: 1959 a single computer instruction that stands for a sequence of operations 18

19 Lexical Macros Operate on sequences of tokens Are handled by a preprocessor Are independent of the host language syntax Examples: CPP TeX 19

20 CPP - The C Preprocessor Integrated into C compilers Also works as a stand-alone expander Intercepts directives such as: #define #undef #ifdef #if #include 20

21 Lexical Macro Example CPP macro to square a number: #define square(x) X * X square(z + 1) z + 1 * z

22 Lexical Macro Example CPP macro to square a number: #define square(x) X * X square(z + 1) z + (1 * z) + 1 Adding parentheses as a hack: #define square(x) (X) * (X) square(z + 1) (z + 1)*(z + 1) 22

23 Parsing Problem #define swap(x,y) { int t=x; X=Y; Y=t; } if (a > b) swap(a,b); else b=0; *** test.c:3: parse error before 'else' 23

24 Parsing Problem Hack #define swap(x,y) { int t=x; X=Y; Y=t; } if (a > b) swap(a,b); else b=0; *** test.c:3: parse error before 'else' #define swap(x,y) do { int t=x; X=Y; Y=t; } while (0) if (a > b) swap(a,b); else b=0; 24

25 Expansion Time #define A 87 #define B A #undef A #define A 42 B??? Eager expansion (definition time): B 87 Lazy expansion (invocation time): B A 42 CPP is lazy 25

26 Expansion Order #define id(x) X #define one(x) id(x) #define two a,b one(two)??? Inner ( call-by-value ): one(two) one(a,b) *** arity error 'one' Outer ( call-by-name ): one(two) id(two) two a,b 26

27 Expansion Order in CPP CPP uses a pragmatic "argument prescan": one(two) id(a,b) *** arity error 'id' Useful for composing macros: #define succ(x) ((X)+1) #define call7(x) X(7) call7(succ) succ(7) ((7)+1) 27

28 Recursive Expansion #define x 1+x x??? Definition time: *** recursive definition Invocation time: x 1+x 1+1+x x... 28

29 Recursive Expansion in CPP CPP uses a pragmatic "intercept-and-ignore": int x = 2; #define x = 1+x x 1+x Maintain a stack of macro invocations Ignore invocations of macros already on the stack At runtime the value of x is 3 29

30 TeX Macros \def \vector #1[#2..#3] { } $({#1}_{#2},\ldots,{#1}_{#3})$ \vector \phi[0..n-1] $({\phi}_{0},\ldots,{\phi}_{n-1})$ Flexible invocation syntax Parsing ambiguities (chooses shortest invocation) Expansion is lazy and outer Recursion is permitted (conditions allowed) 30

31 Syntactic Macros Operate on sequences of ASTs Are handled by the parser Are integrated with the host language syntax Examples: C++ templates Jakarta Tool Suite 31

32 C++ Templates Integrated into C++ compilers Is intended as a genericity mechanism But is often used as a macro language Macros accept ASTs for: identifers constants types The result is always an AST for a declaration 32

33 Syntactic Macro Example template <class T> T GetMax(T x, T y) { return (x>y?x:y); } int i,j; max = GetMax <int> (i,j); Template bodies are parsed at definition time (unlike CPP macros) Templates are syntactically expanded Heavy use of templates yields bloated code (unlike Java generics that are not macros) 33

34 Metaprogramming C++ templates: perform compile time constant folding of arguments allow multiple template definitions and pattern matching This combination enables metaprogramming: Turing-complete computations during compilation Template libraries exist for: booleans control structures functions variables data structures 34

35 Metaprogramming Example template <int X, int Y> struct pow { static const int n=x*pow<x,y-1>::n; }; template <int X> struct pow<x,0> { static const int n = 1; }; const int z = pow<5,3>::n; The value 125 is assigned to z at compile time 35

36 Metaprogramming for Specialization template <int I> inline float dot(float *a, float *b) { return dot<i-1>(a,b) + a[i]*b[i]; } template <> inline float dot<0>(float *a, float *b) { return a[0]*b[0]; } float x[3], y[3]; float z = dot<2>(x,y); float z = x[0]*y[0] + x[1]*y[1] + x[2]*y[2]; The overhead of control structures are removed 36

37 Jakarta Tool Suite JTS extends Java with simple syntactic macros Macros accept ASTs for: AST_QualifiedName AST_Exp AST_Stm AST_FieldDecl AST_Class AST_TypeName The result is an AST specified as: exp{... }exp stm{... }stm mth{... }mth cls{... }cls 37

38 Hygienic Macros macro swap(ast_qualifiedname x, AST_QualifiedName y) local temp stm{ int temp = x; x = y; y = temp; }stm int temp = 42; int tump = 87; #swap(temp,tump); Potential name clash problem: int temp = temp; temp = tump; tump = temp; But local names are renamed uniquely: int temp143 = temp; temp = tump; tump = temp143; Hygienic macros are available in Scheme, various macro extensions of Java such as JSE, 38

CSCI 3136 Principles of Programming Languages

CSCI 3136 Principles of Programming Languages CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University Winter 2013 CSCI 3136 Principles of Programming Languages Faculty of Computer Science Dalhousie University

More information

Syntax Check of Embedded SQL in C++ with Proto

Syntax Check of Embedded SQL in C++ with Proto Proceedings of the 8 th International Conference on Applied Informatics Eger, Hungary, January 27 30, 2010. Vol. 2. pp. 383 390. Syntax Check of Embedded SQL in C++ with Proto Zalán Szűgyi, Zoltán Porkoláb

More information

Programming Language Features (cont.) CMSC 330: Organization of Programming Languages. Parameter Passing in OCaml. Call-by-Value

Programming Language Features (cont.) CMSC 330: Organization of Programming Languages. Parameter Passing in OCaml. Call-by-Value CMSC 33: Organization of Programming Languages Programming Language Features (cont.) Names & binding Namespaces Static (lexical) scopes Dynamic scopes Polymorphism Parametric Subtype Ad-hoc Parameter Passing

More information

Textual Modeling Languages

Textual Modeling Languages Textual Modeling Languages Slides 4-31 and 38-40 of this lecture are reused from the Model Engineering course at TU Vienna with the kind permission of Prof. Gerti Kappel (head of the Business Informatics

More information

Static vs. Dynamic. Lecture 10: Static Semantics Overview 1. Typical Semantic Errors: Java, C++ Typical Tasks of the Semantic Analyzer

Static vs. Dynamic. Lecture 10: Static Semantics Overview 1. Typical Semantic Errors: Java, C++ Typical Tasks of the Semantic Analyzer Lecture 10: Static Semantics Overview 1 Lexical analysis Produces tokens Detects & eliminates illegal tokens Parsing Produces trees Detects & eliminates ill-formed parse trees Static semantic analysis

More information

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code

1 Introduction. 2 An Interpreter. 2.1 Handling Source Code 1 Introduction The purpose of this assignment is to write an interpreter for a small subset of the Lisp programming language. The interpreter should be able to perform simple arithmetic and comparisons

More information

Functional Programming

Functional Programming FP 2005 1.1 3 Functional Programming WOLFRAM KAHL kahl@mcmaster.ca Department of Computing and Software McMaster University FP 2005 1.2 4 What Kinds of Programming Languages are There? Imperative telling

More information

Semester Review. CSC 301, Fall 2015

Semester Review. CSC 301, Fall 2015 Semester Review CSC 301, Fall 2015 Programming Language Classes There are many different programming language classes, but four classes or paradigms stand out:! Imperative Languages! assignment and iteration!

More information

Chapter 7: Functional Programming Languages

Chapter 7: Functional Programming Languages Chapter 7: Functional Programming Languages Aarne Ranta Slides for the book Implementing Programming Languages. An Introduction to Compilers and Interpreters, College Publications, 2012. Fun: a language

More information

Compiler I: Syntax Analysis Human Thought

Compiler I: Syntax Analysis Human Thought Course map Compiler I: Syntax Analysis Human Thought Abstract design Chapters 9, 12 H.L. Language & Operating Sys. Compiler Chapters 10-11 Virtual Machine Software hierarchy Translator Chapters 7-8 Assembly

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages Course Organization Introduction CSE 307: Principles of Programming Languages Spring 2015 R. Sekar Course Organization Introduction 1 / 34 Topics 1. Course Organization Info and Support Course Description

More information

The C Programming Language course syllabus associate level

The C Programming Language course syllabus associate level TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming

More information

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6)

Scoping (Readings 7.1,7.4,7.6) Parameter passing methods (7.5) Building symbol tables (7.6) Semantic Analysis Scoping (Readings 7.1,7.4,7.6) Static Dynamic Parameter passing methods (7.5) Building symbol tables (7.6) How to use them to find multiply-declared and undeclared variables Type checking

More information

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages

Chapter 1. Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705. CS-4337 Organization of Programming Languages Chapter 1 CS-4337 Organization of Programming Languages Dr. Chris Irwin Davis Email: cid021000@utdallas.edu Phone: (972) 883-3574 Office: ECSS 4.705 Chapter 1 Topics Reasons for Studying Concepts of Programming

More information

Programming Languages

Programming Languages Programming Languages Qing Yi Course web site: www.cs.utsa.edu/~qingyi/cs3723 cs3723 1 A little about myself Qing Yi Ph.D. Rice University, USA. Assistant Professor, Department of Computer Science Office:

More information

Lecture 1: Introduction

Lecture 1: Introduction Programming Languages Lecture 1: Introduction Benjamin J. Keller Department of Computer Science, Virginia Tech Programming Languages Lecture 1 Introduction 2 Lecture Outline Preview History of Programming

More information

Semantic Analysis: Types and Type Checking

Semantic Analysis: Types and Type Checking Semantic Analysis Semantic Analysis: Types and Type Checking CS 471 October 10, 2007 Source code Lexical Analysis tokens Syntactic Analysis AST Semantic Analysis AST Intermediate Code Gen lexical errors

More information

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 7 Scanner Parser Project Wednesday, September 7 DUE: Wednesday, September 21 This

More information

YouTrack MPS case study

YouTrack MPS case study YouTrack MPS case study A case study of JetBrains YouTrack use of MPS Valeria Adrianova, Maxim Mazin, Václav Pech What is YouTrack YouTrack is an innovative, web-based, keyboard-centric issue and project

More information

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper Parsing Technology and its role in Legacy Modernization A Metaware White Paper 1 INTRODUCTION In the two last decades there has been an explosion of interest in software tools that can automate key tasks

More information

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz 2007 03 16

Advanced compiler construction. General course information. Teacher & assistant. Course goals. Evaluation. Grading scheme. Michel Schinz 2007 03 16 Advanced compiler construction Michel Schinz 2007 03 16 General course information Teacher & assistant Course goals Teacher: Michel Schinz Michel.Schinz@epfl.ch Assistant: Iulian Dragos INR 321, 368 64

More information

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser) High-Level Programming Languages Nell Dale & John Lewis (adaptation by Michael Goldwasser) Low-Level Languages What are disadvantages of low-level languages? (e.g., machine code or assembly code) Programming

More information

COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing

COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing COMP 356 Programming Language Structures Notes for Chapter 4 of Concepts of Programming Languages Scanning and Parsing The scanner (or lexical analyzer) of a compiler processes the source program, recognizing

More information

Object-Oriented Software Specification in Programming Language Design and Implementation

Object-Oriented Software Specification in Programming Language Design and Implementation Object-Oriented Software Specification in Programming Language Design and Implementation Barrett R. Bryant and Viswanathan Vaidyanathan Department of Computer and Information Sciences University of Alabama

More information

Introduction. Compiler Design CSE 504. Overview. Programming problems are easier to solve in high-level languages

Introduction. Compiler Design CSE 504. Overview. Programming problems are easier to solve in high-level languages Introduction Compiler esign CSE 504 1 Overview 2 3 Phases of Translation ast modifled: Mon Jan 28 2013 at 17:19:57 EST Version: 1.5 23:45:54 2013/01/28 Compiled at 11:48 on 2015/01/28 Compiler esign Introduction

More information

Scanning and parsing. Topics. Announcements Pick a partner by Monday Makeup lecture will be on Monday August 29th at 3pm

Scanning and parsing. Topics. Announcements Pick a partner by Monday Makeup lecture will be on Monday August 29th at 3pm Scanning and Parsing Announcements Pick a partner by Monday Makeup lecture will be on Monday August 29th at 3pm Today Outline of planned topics for course Overall structure of a compiler Lexical analysis

More information

CA4003 - Compiler Construction

CA4003 - Compiler Construction CA4003 - Compiler Construction David Sinclair Overview This module will cover the compilation process, reading and parsing a structured language, storing it in an appropriate data structure, analysing

More information

Advanced Functional Programming (9) Domain Specific Embedded Languages

Advanced Functional Programming (9) Domain Specific Embedded Languages Advanced Functional Programming (9) Domain Specific Embedded Languages Advanced Functional Programming (9) Domain Specific Embedded Languages, Universiteit Utrecht http://www.cs.uu.nl/groups/st/ February

More information

Databases 2011 The Relational Model and SQL

Databases 2011 The Relational Model and SQL Databases 2011 Christian S. Jensen Computer Science, Aarhus University What is a Database? Main Entry: da ta base Pronunciation: \ˈdā-tə-ˌbās, ˈda- also ˈdä-\ Function: noun Date: circa 1962 : a usually

More information

Passing Arguments. A comparison among programming languages. Curtis Bright. April 20, 2011

Passing Arguments. A comparison among programming languages. Curtis Bright. April 20, 2011 Passing Arguments A comparison among programming languages Curtis Bright April 20, 2011 Abstract This report describes and compares the argument passing styles used in contemporary programming languages,

More information

Compiler Construction

Compiler Construction Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from

More information

SQL and Programming Languages. SQL in Programming Languages. Applications. Approaches

SQL and Programming Languages. SQL in Programming Languages. Applications. Approaches SQL and Programming Languages SQL in Programming Languages Read chapter 5 of Atzeni et al. BD: Modelli e Linguaggi di Interrogazione and section 8.4 of Garcia-Molina The user does not want to execute SQL

More information

DSL Contest - Evaluation and Benchmarking of DSL Technologies. Kim David Hagedorn, Kamil Erhard Advisor: Tom Dinkelaker

DSL Contest - Evaluation and Benchmarking of DSL Technologies. Kim David Hagedorn, Kamil Erhard Advisor: Tom Dinkelaker DSL Contest - Evaluation and Benchmarking of DSL Technologies Kim David Hagedorn, Kamil Erhard Advisor: Tom Dinkelaker September 30, 2009 Contents 1 Introduction 2 1.1 Domain Specific Languages.....................

More information

Lecture 9. Semantic Analysis Scoping and Symbol Table

Lecture 9. Semantic Analysis Scoping and Symbol Table Lecture 9. Semantic Analysis Scoping and Symbol Table Wei Le 2015.10 Outline Semantic analysis Scoping The Role of Symbol Table Implementing a Symbol Table Semantic Analysis Parser builds abstract syntax

More information

Parameter passing in LISP

Parameter passing in LISP Parameter passing in LISP The actual parameters in a function call are always expressions, represented as lists structures. LISP provides two main methods of parameter passing: Pass/Call-by-value. The

More information

BRICS. Growing Languages with Metamorphic Syntax Macros

BRICS. Growing Languages with Metamorphic Syntax Macros BRICS Basic Research in Computer Science BRICS RS-00-24 Brabrand & Schwartzbach: Growing Languages with Metamorphic Syntax Macros Growing Languages with Metamorphic Syntax Macros Claus Brabrand Michael

More information

Language Processing Systems

Language Processing Systems Language Processing Systems Evaluation Active sheets 10 % Exercise reports 30 % Midterm Exam 20 % Final Exam 40 % Contact Send e-mail to hamada@u-aizu.ac.jp Course materials at www.u-aizu.ac.jp/~hamada/education.html

More information

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)

More information

Functional Programming in C++11

Functional Programming in C++11 Functional Programming in C++11 science + computing ag IT-Dienstleistungen und Software für anspruchsvolle Rechnernetze Tübingen München Berlin Düsseldorf An Overview Programming in a functional style

More information

C Compiler Targeting the Java Virtual Machine

C Compiler Targeting the Java Virtual Machine C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the

More information

Principles of Programming Languages Topic: Introduction Professor Louis Steinberg

Principles of Programming Languages Topic: Introduction Professor Louis Steinberg Principles of Programming Languages Topic: Introduction Professor Louis Steinberg CS 314, LS,LTM: L1: Introduction 1 Contacts Prof. Louis Steinberg lou @ cs.rutgers.edu x5-3581 401 Hill TA: to be announced

More information

How To Use The C Preprocessor

How To Use The C Preprocessor Environnements et Outils de Développement Cours 3 The C build process Stefano Zacchiroli zack@pps.univ-paris-diderot.fr Laboratoire PPS, Université Paris Diderot - Paris 7 URL http://upsilon.cc/~zack/teaching/1112/ed6/

More information

Cedalion A Language Oriented Programming Language (Extended Abstract)

Cedalion A Language Oriented Programming Language (Extended Abstract) Cedalion A Language Oriented Programming Language (Extended Abstract) David H. Lorenz Boaz Rosenan The Open University of Israel Abstract Implementations of language oriented programming (LOP) are typically

More information

Compiler Construction

Compiler Construction Compiler Construction Regular expressions Scanning Görel Hedin Reviderad 2013 01 23.a 2013 Compiler Construction 2013 F02-1 Compiler overview source code lexical analysis tokens intermediate code generation

More information

SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova

SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova SQL INJECTION ATTACKS By Zelinski Radu, Technical University of Moldova Where someone is building a Web application, often he need to use databases to store information, or to manage user accounts. And

More information

Anatomy of Programming Languages. William R. Cook

Anatomy of Programming Languages. William R. Cook Anatomy of Programming Languages William R. Cook Copyright (C) 2013 2 Chapter 1 Preliminaries Preface What? This document is a series of notes about programming languages, originally written for students

More information

Programming Language Pragmatics

Programming Language Pragmatics Programming Language Pragmatics THIRD EDITION Michael L. Scott Department of Computer Science University of Rochester ^ШШШШШ AMSTERDAM BOSTON HEIDELBERG LONDON, '-*i» ЩЛ< ^ ' m H NEW YORK «OXFORD «PARIS»SAN

More information

n Introduction n Art of programming language design n Programming language spectrum n Why study programming languages? n Overview of compilation

n Introduction n Art of programming language design n Programming language spectrum n Why study programming languages? n Overview of compilation Lecture Outline Programming Languages CSCI-4430 & CSCI-6430, Spring 2016 www.cs.rpi.edu/~milanova/csci4430/ Ana Milanova Lally Hall 314, 518 276-6887 milanova@cs.rpi.edu Office hours: Wednesdays Noon-2pm

More information

Organization of DSLE part. Overview of DSLE. Model driven software engineering. Engineering. Tooling. Topics:

Organization of DSLE part. Overview of DSLE. Model driven software engineering. Engineering. Tooling. Topics: Organization of DSLE part Domain Specific Language Engineering Tooling Eclipse plus EMF Xtext, Xtend, Xpand, QVTo and ATL Prof.dr. Mark van den Brand GLT 2010/11 Topics: Meta-modeling Model transformations

More information

SDMX technical standards Data validation and other major enhancements

SDMX technical standards Data validation and other major enhancements SDMX technical standards Data validation and other major enhancements Vincenzo Del Vecchio - Bank of Italy 1 Statistical Data and Metadata exchange Original scope: the exchange Statistical Institutions

More information

Implementing Programming Languages. Aarne Ranta

Implementing Programming Languages. Aarne Ranta Implementing Programming Languages Aarne Ranta February 6, 2012 2 Contents 1 What is a programming language implementation 11 1.1 From language to binary..................... 11 1.2 Levels of languages........................

More information

How to make the computer understand? Lecture 15: Putting it all together. Example (Output assembly code) Example (input program) Anatomy of a Computer

How to make the computer understand? Lecture 15: Putting it all together. Example (Output assembly code) Example (input program) Anatomy of a Computer How to make the computer understand? Fall 2005 Lecture 15: Putting it all together From parsing to code generation Write a program using a programming language Microprocessors talk in assembly language

More information

Chapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications

Chapter 13. Introduction to SQL Programming Techniques. Database Programming: Techniques and Issues. SQL Programming. Database applications Chapter 13 SQL Programming Introduction to SQL Programming Techniques Database applications Host language Java, C/C++/C#, COBOL, or some other programming language Data sublanguage SQL SQL standards Continually

More information

WIRIS quizzes web services Getting started with PHP and Java

WIRIS quizzes web services Getting started with PHP and Java WIRIS quizzes web services Getting started with PHP and Java Document Release: 1.3 2011 march, Maths for More www.wiris.com Summary This document provides client examples for PHP and Java. Contents WIRIS

More information

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Scanner-Parser Project Thursday, Feb 7 DUE: Wednesday, Feb 20, 9:00 pm This project

More information

An Eclipse Plug-In for Visualizing Java Code Dependencies on Relational Databases

An Eclipse Plug-In for Visualizing Java Code Dependencies on Relational Databases An Eclipse Plug-In for Visualizing Java Code Dependencies on Relational Databases Paul L. Bergstein, Priyanka Gariba, Vaibhavi Pisolkar, and Sheetal Subbanwad Dept. of Computer and Information Science,

More information

7. Building Compilers with Coco/R. 7.1 Overview 7.2 Scanner Specification 7.3 Parser Specification 7.4 Error Handling 7.5 LL(1) Conflicts 7.

7. Building Compilers with Coco/R. 7.1 Overview 7.2 Scanner Specification 7.3 Parser Specification 7.4 Error Handling 7.5 LL(1) Conflicts 7. 7. Building Compilers with Coco/R 7.1 Overview 7.2 Scanner Specification 7.3 Parser Specification 7.4 Error Handling 7.5 LL(1) Conflicts 7.6 Example 1 Coco/R - Compiler Compiler / Recursive Descent Generates

More information

Real SQL Programming 1

Real SQL Programming 1 Real 1 We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional programs

More information

Habanero Extreme Scale Software Research Project

Habanero Extreme Scale Software Research Project Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead

More information

Embedded Software Development with MPS

Embedded Software Development with MPS Embedded Software Development with MPS Markus Voelter independent/itemis The Limitations of C and Modeling Tools Embedded software is usually implemented in C. The language is relatively close to the hardware,

More information

Moving from CS 61A Scheme to CS 61B Java

Moving from CS 61A Scheme to CS 61B Java Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you

More information

Generalizing Overloading for C++2000

Generalizing Overloading for C++2000 Generalizing Overloading for C++2000 Bjarne Stroustrup AT&T Labs, Florham Park, NJ, USA Abstract This paper outlines the proposal for generalizing the overloading rules for Standard C++ that is expected

More information

Glossary of Object Oriented Terms

Glossary of Object Oriented Terms Appendix E Glossary of Object Oriented Terms abstract class: A class primarily intended to define an instance, but can not be instantiated without additional methods. abstract data type: An abstraction

More information

Programming Database lectures for mathema

Programming Database lectures for mathema Programming Database lectures for mathematics students April 25, 2015 Functions Functions are defined in Postgres with CREATE FUNCTION name(parameter type,...) RETURNS result-type AS $$ function-body $$

More information

03 - Lexical Analysis

03 - Lexical Analysis 03 - Lexical Analysis First, let s see a simplified overview of the compilation process: source code file (sequence of char) Step 2: parsing (syntax analysis) arse Tree Step 1: scanning (lexical analysis)

More information

Context free grammars and predictive parsing

Context free grammars and predictive parsing Context free grammars and predictive parsing Programming Language Concepts and Implementation Fall 2012, Lecture 6 Context free grammars Next week: LR parsing Describing programming language syntax Ambiguities

More information

CS346: Database Programming. http://warwick.ac.uk/cs346

CS346: Database Programming. http://warwick.ac.uk/cs346 CS346: Database Programming http://warwick.ac.uk/cs346 1 Database programming Issue: inclusionofdatabasestatementsinaprogram combination host language (general-purpose programming language, e.g. Java)

More information

CSE 130 Programming Language Principles & Paradigms

CSE 130 Programming Language Principles & Paradigms CSE 130 Programming Language Principles & Paradigms Thomas A. Powell tpowell@pint.com Housekeeping Syllabus review Direct class page link http://www.pint.com/classes/cse130 Updated syllabus, notes, homework

More information

A Framework for Extensible Languages

A Framework for Extensible Languages A Framework for Extensible Languages Sebastian Erdweg TU Darmstadt, Germany Felix Rieger TU Darmstadt, Germany Abstract Extensible programming languages such as SugarJ or Racket enable programmers to introduce

More information

The Design Maintenance System (DMS ) A Tool for Automating Software Quality Enhancement

The Design Maintenance System (DMS ) A Tool for Automating Software Quality Enhancement The Design Maintenance System (DMS ) A Tool for Automating Software Quality Enhancement Ira D. Baxter, Ph.D. Semantic Designs, Inc. www.semdesigns.com Keywords software quality, design capture, knowledge

More information

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages

Language Evaluation Criteria. Evaluation Criteria: Readability. Evaluation Criteria: Writability. ICOM 4036 Programming Languages ICOM 4036 Programming Languages Preliminaries Dr. Amirhossein Chinaei Dept. of Electrical & Computer Engineering UPRM Spring 2010 Language Evaluation Criteria Readability: the ease with which programs

More information

The Advantages of Multi-Stage Programming

The Advantages of Multi-Stage Programming A Gentle Introduction to Multi-stage Programming Walid Taha Department of Computer Science, Rice University, Houston, TX, USA taha@rice.edu Abstract. Multi-stage programming (MSP) is a paradigm for developing

More information

1.1 WHAT IS A PROGRAMMING LANGUAGE?

1.1 WHAT IS A PROGRAMMING LANGUAGE? 1 INTRODUCTION 1.1 What is a Programming Language? 1.2 Abstractions in Programming Languages 1.3 Computational Paradigms 1.4 Language Definition 1.5 Language Translation 1.6 Language Design How we communicate

More information

Theory of Compilation

Theory of Compilation Theory of Compilation JLex, CUP tools CS Department, Haifa University Nov, 2010 By Bilal Saleh 1 Outlines JLex & CUP tutorials and Links JLex & CUP interoperability Structure of JLex specification JLex

More information

Functional Programming. Functional Programming Languages. Chapter 14. Introduction

Functional Programming. Functional Programming Languages. Chapter 14. Introduction Functional Programming Languages Chapter 14 Introduction Functional programming paradigm History Features and concepts Examples: Lisp ML 1 2 Functional Programming Functional Programming Languages The

More information

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.

Compilers. Introduction to Compilers. Lecture 1. Spring term. Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam. Compilers Spring term Mick O Donnell: michael.odonnell@uam.es Alfonso Ortega: alfonso.ortega@uam.es Lecture 1 to Compilers 1 Topic 1: What is a Compiler? 3 What is a Compiler? A compiler is a computer

More information

The Mjølner BETA system

The Mjølner BETA system FakePart I FakePartTitle Software development environments CHAPTER 2 The Mjølner BETA system Peter Andersen, Lars Bak, Søren Brandt, Jørgen Lindskov Knudsen, Ole Lehrmann Madsen, Kim Jensen Møller, Claus

More information

COS 301 Programming Languages

COS 301 Programming Languages Preliminaries COS 301 Programming Languages Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories

More information

A Multi-layered Domain-specific Language for Stencil Computations

A Multi-layered Domain-specific Language for Stencil Computations A Multi-layered Domain-specific Language for Stencil Computations Christian Schmitt, Frank Hannig, Jürgen Teich Hardware/Software Co-Design, University of Erlangen-Nuremberg Workshop ExaStencils 2014,

More information

Design Patterns in Parsing

Design Patterns in Parsing Abstract Axel T. Schreiner Department of Computer Science Rochester Institute of Technology 102 Lomb Memorial Drive Rochester NY 14623-5608 USA ats@cs.rit.edu Design Patterns in Parsing James E. Heliotis

More information

CSC 272 - Software II: Principles of Programming Languages

CSC 272 - Software II: Principles of Programming Languages CSC 272 - Software II: Principles of Programming Languages Lecture 1 - An Introduction What is a Programming Language? A programming language is a notational system for describing computation in machine-readable

More information

The previous chapter provided a definition of the semantics of a programming

The previous chapter provided a definition of the semantics of a programming Chapter 7 TRANSLATIONAL SEMANTICS The previous chapter provided a definition of the semantics of a programming language in terms of the programming language itself. The primary example was based on a Lisp

More information

Chapter 6: Programming Languages

Chapter 6: Programming Languages Chapter 6: Programming Languages Computer Science: An Overview Eleventh Edition by J. Glenn Brookshear Copyright 2012 Pearson Education, Inc. Chapter 6: Programming Languages 6.1 Historical Perspective

More information

Chapter 5 Functions. Introducing Functions

Chapter 5 Functions. Introducing Functions Chapter 5 Functions 1 Introducing Functions A function is a collection of statements that are grouped together to perform an operation Define a function Invoke a funciton return value type method name

More information

Static Analyzers. Context. Learning Objectives

Static Analyzers. Context. Learning Objectives Static Analyzers Wolfgang Emmerich Professor of Distributed Computing University College London http://sse.cs.ucl.ac.uk Context Requirements Inception Elaboration Construction Transition Analysis Design

More information

How to Improve Database Connectivity With the Data Tools Platform. John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management)

How to Improve Database Connectivity With the Data Tools Platform. John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management) How to Improve Database Connectivity With the Data Tools Platform John Graham (Sybase Data Tooling) Brian Payton (IBM Information Management) 1 Agenda DTP Overview Creating a Driver Template Creating a

More information

Language Oriented Programming

Language Oriented Programming Language Oriented Programming M. P. Ward Computer Science Department Science Labs, South Rd Durham, DH1 3LE October 1994 Abstract This paper describes the concept of language oriented programming which

More information

Master of Sciences in Informatics Engineering Programming Paradigms 2005/2006. Final Examination. January 24 th, 2006

Master of Sciences in Informatics Engineering Programming Paradigms 2005/2006. Final Examination. January 24 th, 2006 Master of Sciences in Informatics Engineering Programming Paradigms 2005/2006 Final Examination January 24 th, 2006 NAME: Please read all instructions carefully before start answering. The exam will be

More information

Microphone Modem Model, and MinML Modification

Microphone Modem Model, and MinML Modification Programming Languages: Theory and Practice (WORKING DRAFT OF SEPTEMBER 19, 2005.) Robert Harper Carnegie Mellon University Spring Semester, 2005 Copyright c 2005. All Rights Reserved. Preface This is a

More information

A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION

A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION A TOOL FOR DATA STRUCTURE VISUALIZATION AND USER-DEFINED ALGORITHM ANIMATION Tao Chen 1, Tarek Sobh 2 Abstract -- In this paper, a software application that features the visualization of commonly used

More information

Unit Testing for Domain-Specific Languages

Unit Testing for Domain-Specific Languages Unit Testing for Domain-Specific Languages 1 Hui Wu, 1 Jeff Gray and 2 Marjan Mernik 1 Department of Computer and Information Sciences, University of Alabama at Birmingham Birmingham, Alabama USA {wuh,gray}@cis.uab.edu

More information

MEAP Edition Manning Early Access Program Nim in Action Version 1

MEAP Edition Manning Early Access Program Nim in Action Version 1 MEAP Edition Manning Early Access Program Nim in Action Version 1 Copyright 2016 Manning Publications For more information on this and other Manning titles go to www.manning.com Welcome Thank you for purchasing

More information

Building Call Graphs for Embedded Client-Side Code in Dynamic Web Applications

Building Call Graphs for Embedded Client-Side Code in Dynamic Web Applications Building Call Graphs for Embedded Client-Side Code in Dynamic Web Applications Hung Viet Nguyen ECpE Department Iowa State University, USA Christian Kästner School of Computer Science Carnegie Mellon University,

More information

ML for the Working Programmer

ML for the Working Programmer ML for the Working Programmer 2nd edition Lawrence C. Paulson University of Cambridge CAMBRIDGE UNIVERSITY PRESS CONTENTS Preface to the Second Edition Preface xiii xv 1 Standard ML 1 Functional Programming

More information

Teaching Pragmatic Model-Driven Software Development

Teaching Pragmatic Model-Driven Software Development Computer Science and Information Systems 12(2):683 705 DOI: 10.2298/CSIS140107022P Teaching Pragmatic Model-Driven Software Development Jaroslav Porubän, Michaela Bačíková, Sergej Chodarev and Milan Nosál

More information

[Refer Slide Time: 05:10]

[Refer Slide Time: 05:10] Principles of Programming Languages Prof: S. Arun Kumar Department of Computer Science and Engineering Indian Institute of Technology Delhi Lecture no 7 Lecture Title: Syntactic Classes Welcome to lecture

More information

Programming Languages CIS 443

Programming Languages CIS 443 Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception

More information

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C

Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C Embedded Programming in C/C++: Lesson-1: Programming Elements and Programming in C 1 An essential part of any embedded system design Programming 2 Programming in Assembly or HLL Processor and memory-sensitive

More information