DSL developement through language embedding and extension

Size: px
Start display at page:

Download "DSL developement through language embedding and extension"

Transcription

1 DSL developement through language embedding and extension February 5, 2010 Contents 1 Introduction How language embedding and extension relate Classifying extension techniques Paraphrase Orthophrase Metaphrase Concrete languages Assimilation with MetaBorg A (small) preprocessor language Augmenting Haskell Generalization of modular design 10 5 Conclusion 11

2 1 Introduction Developing Domain Specific Languages (DSLs) often is a process in which compiler specialists and domain experts create the language envisioned by the latter applying restrictions and rules known only to the former. During the developement, many things have to be taken into account by the compiler specialists for which well-known and tested solutions exist - for example typing and scope rules. Modern compiler generators ease the task of applying those techniques to new languages. The idea of language embedding and extension is to even remove those basic tasks from the language developement process by using an existing language with established typing and scoping rules (as well as further functionality) and augment that now so-called host language to express domain specific ideas by means such as modifying the syntax of the host language or integrating already present tools and language constructs. The goal of this paper is to give the reader an overview about the general ideas behind DSL design through language embedding and extension, present some abstract concepts as well as their concrete counterparts and briefly discuss some of their advantages and disadvantages. Embedding techniques such as PHP in HTML are not to be discussed as they don t integrate both languages into a DSL. The main source of information about general concepts are a quite old but classic paper by Standish [Sta75] and a more recent paper by Zingaro [Zin07] that discusses the situation of embedding and extension today. Modern concepts and concrete implementations are taken from [Hud98], [Slo02] and [BGV05]. The paper is structured as follows: In section 2, I will show a classification of embedding and extension techniques which I will use to classify the concrete techniques and languages presented as examples in section 3. Section 4 presents a special concept of generalization proposed by Hudak that takes extension to the extreme. Section 5 concludes the paper. 1.1 How language embedding and extension relate Language embedding and extension are two sides of the same medal. As mentioned above, the aim of both techniques is the augmentation of an established programming language (the host language) such that a domain expert can use the resulting language to express domain specific ideas with it. The idea of language embedding takes the host language and embeds within it a guest language that can express domain specific ideas. Language extension takes the host language and augments it with new syntax and semantics such that the domain specific ideas can be expressed in the new language. In both cases the domain expert is able to express domain specific ideas in the resulting language using the basic structure of the host language augmented by ideas of his domain. The only difference is the view on the augmentation process. Where language embedding requires a pre-existing guest language expressing domain specific ideas, language extension integrates those ideas directly into the host language. An example for a (com- 2

3 pletely fictional) language embedding is shown in listing 1. It uses Java Annotations to declare the annotation language and backticks to include external code fragments. p u b l i c c l a s s MyEmbeddingClass ( " bash " ) p u b l i c v oid embeddedmethod ( S t r i n g x ) { r e t u r n echo $x sed e " s / foo / b a r / g " ; Listing 1: Fictional language embedding Listing 2 shows the same code fragment but in a (again fictional) language called Java- Bash. It tries to capture the essence of bash-programming (namely the concept of pipes and filters) and applies it to standard Java. Both listings are only given to show the main differences and similarities between language embedding and extension. They are in no way meant to be examples for feasible or even working languages. p u b l i c c l a s s MyExtensionClass { p u b l i c v oid extendedmethod ( S t r i n g x ) { r e t u r n s t r i n g T o P i p e x s u b s t i t u t e " foo " " b a r " ; Listing 2: Fictional language extension JavaBash 2 Classifying extension techniques Lexical analysis paraphrase orthophrase Syntactic analysis metaphrase Semantic analysis Figure 1: Extension techniques and compiler phases Nowadays, language embedding and extension comes in various forms but it was in 1975 already, that Thomas A. Standish coined the terms of paraphrase, orthophrase 3

4 and metaphrase [Sta75] that are still in use today [Zin07]. Figure 1 shows how those techniques relate to compiler phases. An in-depth explanation is found below. 2.1 Paraphrase Paraphrase means to define something new by showing how to exchange it for something whose meaning is known [Sta75] and thus adding new features by relying on features already present in the language [Zin07]. Typical cases of paraphrase include user-defined macros and preprocessors. The new language defined by the macro- or preprocessor-engine transforms valid programs in its own syntax into valid programs or program fragments of the target language. Paraphrasive techniques are in most cases applied before or directly after the lexical analysis of the source program. The scanner and parser themselves can be left unmodified. Listing 3 shows paraphrase as implemented in C with preprocessor statements. Before the code is fed into the actual compiler, the preprocessor-statements are evaluated. Every occurence of (the letters) PI is then replaced by # i n c l u d e < s t d i o. h> # d e f i n e PI i n t main ( void ) { p r i n t f ( " Pi i s %f \ n ", PI ) ; return 0 ; Listing 3: Paraphrase - The C preprocessor Advantages and disadvantages An advantage of paraphrasive techniques is that they require relatively little knowledge about the internals of the compilation process. The actual compiler is to a great extent left untouched and the preprocessing or macro extension is handled by an external tool. A big problem when using paraphrase is the fact that the transformation step often has no knowledge about the structure and semantics of the target program in which the generated code will be inserted. This may result in unwanted behaviour or binding of variables if the transformation introduces names that are already bound in the scope the fragment is to be inserted into. Listing 4 shows a program in which the textual replacement leads to the wrong result because 5*PI_PLUS_ONE is replaced by 5* and the multplication has a higher precedence than the addition. There are more such problems with textual replacement and the C preprocessor community has come up with various tips and suggestions for avoiding such problems. More information about the C preprocessor and common problems with its usage can be found in [EBN02]. The terms hygienic and unhygienic expansion are also used in this context. 4

5 Extension systems that are hygienic have some mechanism for avoidance of problems as mentioned above whereas unhygienic techniques don t bother with those problems and leave that to the user. # i n c l u d e < s t d i o. h> # d e f i n e PI_PLUS_ONE i n t main ( void ) { p r i n t f ( " 5 piplusone = %f \ n ",5 PI_PLUS_ONE ) ; return 0 ; Listing 4: Paraphrase gone wrong 2.2 Orthophrase Orthophrase means adding orthogonal features to a language where an orthogonal feature is a feature which lies outside the space of features expressible by paraphrase. Its defining expression cannot be composed in the language [Sta75]. It thus means adding features not expressible in terms of available language primitives [Zin07]. The feature has to be added via manipulation of the language definition itself. In most cases, orthophrasive techniques require a modification of all parts of the compiler toolchain, as no syntax or semantics can be reused. The term orthophrase is mainly used for low-level extensions of languages such as adding IO-features to languages which don t support direct access to the filesystem. (e.g. to the formula language of modern spreadsheet applications) Advantages and disadvantages Orthophrase seems to be the most powerful approach to language extension as it enables the user to specify completely new syntax and semantics - preferrably for his domain. The big disadvantage is, that orthophrasive techniques require heavy modifications of most of the compiler phases and the corresponding tools. As orthophrasive techniques mostly aren t easily and quickly applicable, they are irrelevant for easy DSL design. 2.3 Metaphrase Metaphrase means altering the interpretation rules of a language so that it processes old expressions in new ways [Sta75]. In most cases, these techniques alter the context-free grammar of a host language by adding or changing productions such that domain specific concepts are expressible in the resulting language. Most metaphrasive techniques try to find a language that meets most of the users needs regarding general functionality 5

6 and add only domain specific parts to the expressible ideas. The host language should be selected such that no orthogonal features have to be added - otherwise orthophrase would have to be used. The concrete languages discussed in this paper use mainly metaphrasive techniques Advantages and disadvantages The main advantage of metaphrasive techniques is, that most of the host language can be left untouched and can be reused in the new language. A disadvantage is, that the use of those techniques requires insight into the inner working of the compiler. 3 Concrete languages In this section, I will introduce some concrete extension and embedding techniques for DSL design, explain their main concepts regarding the above classification and explain their concrete advantages and disadvantages. 3.1 Assimilation with MetaBorg Bravenboer et al. propose the MetaBorg method as a general way of providing domainspecific notation for domain abstractions [BGV05]. They integrate two languages completely, so that the resulting language uses notations of both parent languages. Their idea is the approach of assimilation which means that a guest language is not only embedded in a host language but that inside the embedded code fragments it is possible to use notations of the host language thus allowing a host language (collective) to incorporate and assimilate external domains (cultures) [BGV05]. MetaBorg can be regarded as a two-way metaphrasive system as two existing language are integrated very tightly by modifying and combining the grammars of both languages. The technique works on the syntax level by specifying the exact symbols and productions that have to be modified for the assimilation. An example given in [BGV05] combines Java and regular expression syntax to enable Perl-like use of regular expressions. Java has support for regular expressions but saves them in Strings which under some circumstances require heavy backslashescaping which makes more complicated expressions quite unreadable. The new language is called JavaRegex and allows programs like the one below (example taken from [BGV05]) in which a regular expression for valid IP-addresses is defined and bound to the identifier ipline. Later, this identifier is used with a String-variable input and the new ~?-Operator to check if input matches the regular expression. regex ipline = [/ (([0-1]?\d{1,2\.) (2[0-4]\d\.) (25[0-5]\.)){3 (([0-1]?\d{1,2) (2[0-4]\d) (25[0-5])) 6

7 /] ; if( input ~? ipline ) System.out.println("Input is an ip-number."); else System.out.println("Input is NOT an ip-number."); The tight integration is achieved by first renaming all non-terminals of both langauges (e.g. by prefixing them with letters such that all Java-symbols begin with the letter J and all Regex-symbols begin with the letter R) and then specifying the concrete productions that are to be added and/or modified. The language Stratego/XT is used to specify those transformations. To check the validity of JavaRegex-code, the compiler needs the syntax definitions of valid Java code, the syntax definition of valid regular expressions and information about which productions in both definitions have to be modified to allow for the integration. The actual compilation process of JavaRegex works much like a preprocessor by converting the regular expressions to strings and the ~?-Operator to Java API calls. The advantage of MetaBorg is that it - unlike the C preprocessor - works on syntax level. Error messages can now be displayed in context of the code the user sees and not the generated Java code. 3.2 A (small) preprocessor language The C preprocessor is a paraphrasive system that works on the source text even before it is fed into the syntactic analysis phase. It augments the C language and its derivatives by the possibility to define macros and include other files. The source code itself can now contain terms defined to be replaced and as such can be viewed as source code of an extended language. The C preprocessor is unhygienic and many attempts have been made by C programmers to avoid binding collisions or even unwanted behaviour as mentioned in section The following code shows a small DSL which allows to define attributes for C++ classes in a simple manner. The user of the DSL only has to write attribute(name,type,format) in his class body where name is a valid identifier, type is a valid type and format is a valid character representing the formatting of the attribute in a printf-statement. A small paraphrasive DSL # d e f i n e g e t t e r ( name, t y p e ) t y p e g e t ##name ( ) \ { r e t u r n t h i s >name ; # d e f i n e s e t t e r ( name, t y p e ) void s e t ##name ( t y p e newval ) \ { t h i s >name = newval ; # d e f i n e p r i n t e r ( name, type, f o r m a t ) void p r i n t ##name ( ) \ { p r i n t f ( " ( " # t y p e " ) " # name"=%"# f o r m a t " \ n ", name ) ; # d e f i n e a t t r i b u t e ( name, type, f o r m a t ) p r i v a t e : t y p e name ; \ p u b l i c : \ 7

8 g e t t e r ( name, t y p e ) ; \ s e t t e r ( name, t y p e ) ; \ p r i n t e r ( name, type, f o r m a t ) ; c l a s s r e c t a n g l e { a t t r i b u t e ( width, i n t, d ) a t t r i b u t e ( h e i g h t, i n t, d ) ; 3.3 Augmenting Haskell Hudak [Hud98] proposes a technique in which he uses the functional programming language Haskell as host language and augments it via its own notation. The technique is used by Sloane [Slo02] to re-implement a given language called Odin while trying to keep the new language as close to the original language as possible. For us as software engineers, this technique seems to only define a special API - but if one looks at the resulting notation, it is clearly visible that a domain expert seems to get a language from his own domain. In Haskell it is possible to specify functions and datatypes. This built-in feature is used to define the syntax for a new, domain specific language. The code written in this new language is still perfectly valid Haskell code (given the Haskell functions and datatypes defined by the language designer) but can be understood and written by a domain expert as if it was in a language designed only for his domain Points and Regions Hudak presents a small example language that enables the domain user to work with points and regions as well as intersections and disjunctions of regions. The main datatypes used for calculations in that domain are Point, which represents a single point in the plane (with given x- and y-coordinates) and Region, which represents a region in said plane. A Region is modeled by a function Point -> Bool which returns true iff the given Point is in the given Region. For the specification of circles, another datatype Radius is used, which is simply another name for a real number. The language comes from a naval background and as such can only specify circles around a fixed midpoint (the ship). The functions used on the given datatypes are shown below. Their signatures are in Curry-form. 8

9 Functions in augmented Haskell Function Definition Description inregion Point -> Region -> Bool Checks if a given point lies in a given Region circle Radius -> Region Creates a circular Region with given Radius (/\) Region -> Region -> Region Calculates the Regions that results by intersecting to Regions (\/) Region -> Region -> Region Calculates the Regions that results by combining to Regions The user can now use domain notation such as p r s to check if point p is in the intersection of regions r and s. In the new language, this query looks as follows: p inregion r /\ s. It is evaluated as shown below. It is very nice to see how the domain specific notation (using points and regions) comes closer to the software engineer s view on the language (using functions) with every transformation step Pictures and Animations Evaluation of a simple expression p inregion r /\ s = (r /\ s) p r p && s p Another example by Hudak relies on functional concepts even more. He defines a datatype Picture which represents a picture. Functions to create and manipulate those pictures are the following (defined in [Hud98]): -- Atomic objects: circle -- a unit circle square -- a unit square import "p.gif" -- an imported bit-map -- Composite objects: scale v p -- scale picture p by vector v color c p -- color picture p with color c trans v p -- translate picture p by vector v p1 over p2 -- overlay p1 on p2 p1 above p2 -- place p1 above p2 p1 beside p2 -- place p1 beside p2 Hudak captures the notions of the animation domain by defining the datatype Animation as Time -> Picture - an animation is a function from time to pictures. As not only 9

10 animations have that property, he specifies a more general Behavior for things that can change over time. An animation is now only a special case of a behavior. type Behavior a = Time -> a type Animation = Behavior Picture Hudak then proceeds to lift the operators used for basic picture manipulation to the behavior/animation level by specifying (b1 overb b2) t = b1 t over b2 t (b1 aboveb b2) t = b1 t above b2 t (b1 besideb b2) t = b1 t beside b2 t (scaleb v b) t = scale (v t) (b t) (colorb c b) t = color (c t) (b t) (transb v b) t = trans (v t) (b t) The new operators are now applicable to animations instead of pictures but reuse the underlying operators on pictures to bring their functionality to the animation level. They capture the animation domain by adding a layer that represents behavior (change over time) to the picture domain. It is now possible to add even more layers of concepts by lifting the operators to those levels. In this modular concept it might be possible to describe 3D-animations by first extending the picture domain to a 3D-body domain and then by behavior. This approach leads to the generalization mentioned in section 4 4 Generalization of modular design The idea of (modular) language extension as mentioned in section can be taken to the extremes. Such an approach called Modular Monadic Interpreter is proposed by Hudak. In regular interpreted languages, a term is mapped to an answer. The monadic interpreter maps terms first to computations (called monads, which can easily be expressed in Haskell using the do{-notation) and then to answers. As an example, a regular interpreter would map the term 3*4+1 to the answer 13, whereas a monadic interpreter maps it first to arith(3*4+1) and then to 13 where arith is a function that can calculate results for arithmetic expressions. If the user now wishes to add functionality such as variables or function definitions, he has to specify a function to be used instead of arith. He can do so by transforming the given arith function with a higer-order-function and thus preserving its functionality in his new function. The arith-module can be reused in certain parts of the variable-enabled language, but new concepts need to be added. A new var-function has to be designed, which is a higher-order-function that transforms another function (the monad for arithmetic expressions) into a monad for language that can handle arithmetic expressions using variables. The term 3*a+1 now maps to var(arith)(3*a+1) and then to the result. The next 10

11 layer, function definitions, would map to the result via func(var(arith))(3*a+1). Layer after layer, such transformation steps can be applied to create a more powerful language and its interpreter in every iteration. 5 Conclusion There are many approaches to language embedding and extension which all share the idea of reuse. In most cases, the structure or even the compiler of a host language is reused so that already present solutions for which there exists no need to be adjusted to the problem domain can be used as a part of the new language. Metaphrasic techniques are to be mentioned as having the best tradeoff between ease of implementation and gainable expressiveness of the resulting language. Here, I presented and discussed only some of them. References [BGV05] Martin Bravenboer, Rene De Groot, and Eelco Visser. Metaborg in action: Examples of domain-specific language embedding and assimilation using stratego/xt. In Participants Proceedings of the Summer School on Generative and Transformational Techniques in Software Engineering (GTTSE 05). Springer Verlag, [EBN02] Michael D. Ernst, Greg J. Badros, and David Notkin. An empirical analysis of c preprocessor use. IEEE Transactions on Software Engineering, 28: , [Hud98] [Slo02] [Sta75] [Zin07] P. Hudak. Modular domain specific languages and tools. In ICSR 98: Proceedings of the 5th International Conference on Software Reuse, page 134, Washington, DC, USA, IEEE Computer Society. A. Sloane. Post-design domain-specific language embedding: A case study in the software engineering domain. In HICSS 02: Proceedings of the 35th Annual Hawaii International Conference on System Sciences (HICSS 02)- Volume 9, page 281, Washington, DC, USA, IEEE Computer Society. Thomas A. Standish. Extensibility in programming language design. SIG- PLAN Not., 10(7):18 21, Daniel Zingaro. Modern extensible languages. Technical Report 47, McMaster University SQRL,

The role of semantic analysis in a compiler

The role of semantic analysis in a compiler Semantic Analysis Outline The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Symbol Tables Symbol Table: In computer science, a symbol table is a data structure used by a language translator such as a compiler or interpreter, where each identifier in a program's source code is

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 1 - Introduction Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages Spring 2014

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler Front-End Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Static analyses that detect type errors

More information

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008.

Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008. Program Abstractions, Language Paradigms. CS152. Chris Pollett. Aug. 27, 2008. Outline. Abstractions for telling a computer how to do things. Computational Paradigms. Language Definition, Translation.

More information

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341)

CSE 413 Languages & Implementation. Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) CSE 413 Languages & Implementation Hal Perkins Winter 2019 Structs, Implementing Languages (credits: Dan Grossman, CSE 341) 1 Goals Representing programs as data Racket structs as a better way to represent

More information

SEMANTIC ANALYSIS TYPES AND DECLARATIONS

SEMANTIC ANALYSIS TYPES AND DECLARATIONS SEMANTIC ANALYSIS CS 403: Type Checking Stefan D. Bruda Winter 2015 Parsing only verifies that the program consists of tokens arranged in a syntactically valid combination now we move to check whether

More information

Using Scala for building DSL s

Using Scala for building DSL s Using Scala for building DSL s Abhijit Sharma Innovation Lab, BMC Software 1 What is a DSL? Domain Specific Language Appropriate abstraction level for domain - uses precise concepts and semantics of domain

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Compiler Design i About the Tutorial A compiler translates the codes written in one language to some other language without changing the meaning of the program. It is also expected that a compiler should make the target

More information

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far

Semantic Analysis. Outline. The role of semantic analysis in a compiler. Scope. Types. Where we are. The Compiler so far Outline Semantic Analysis The role of semantic analysis in a compiler A laundry list of tasks Scope Static vs. Dynamic scoping Implementation: symbol tables Types Statically vs. Dynamically typed languages

More information

Concepts of programming languages

Concepts of programming languages Concepts of programming languages Lecture 7 Wouter Swierstra 1 Last time Relating evaluation and types How to handle variable binding in embedded languages? 2 DSLs: approaches A stand-alone DSL typically

More information

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING

PRINCIPLES OF COMPILER DESIGN UNIT I INTRODUCTION TO COMPILING PRINCIPLES OF COMPILER DESIGN 2 MARKS UNIT I INTRODUCTION TO COMPILING 1. Define compiler? A compiler is a program that reads a program written in one language (source language) and translates it into

More information

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1 What is a Design Pattern? Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights and other writers rarely

More information

Semantic Analysis. Lecture 9. February 7, 2018

Semantic Analysis. Lecture 9. February 7, 2018 Semantic Analysis Lecture 9 February 7, 2018 Midterm 1 Compiler Stages 12 / 14 COOL Programming 10 / 12 Regular Languages 26 / 30 Context-free Languages 17 / 21 Parsing 20 / 23 Extra Credit 4 / 6 Average

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2010 Handout Decaf Language Tuesday, Feb 2 The project for the course is to write a compiler

More information

Towards Compositional Domain Specific Languages

Towards Compositional Domain Specific Languages Andreas Horst, Bernhard Rumpe Software Engineering RWTH Aachen University, Germany http://www.se-rwth.de/ 1 Introduction The deployment of Domain Specific Languages (DSL) and in particular Domain Specific

More information

Prototype Environment for Refactoring Clean Programs

Prototype Environment for Refactoring Clean Programs Prototype Environment for Refactoring Clean Programs Extended abstract Rozália Szabó-Nacsa, Péter Diviánszky, Zoltán Horváth Department of Software Technology and Methodology, Eötvös Loránd University,

More information

Lexical Considerations

Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2005 Handout 6 Decaf Language Wednesday, September 7 The project for the course is to write a

More information

Refactoring via Database Representation

Refactoring via Database Representation 6 th International Conference on Applied Informatics Eger, Hungary, January 27 31, 2004. Refactoring via Database Representation Péter Diviánszky 1, Rozália Szabó-Nacsa 2, Zoltán Horváth 1 1 Department

More information

Compositional Model Based Software Development

Compositional Model Based Software Development Compositional Model Based Software Development Prof. Dr. Bernhard Rumpe http://www.se-rwth.de/ Seite 2 Our Working Groups and Topics Automotive / Robotics Autonomous driving Functional architecture Variability

More information

Language Extension and Composition with Language Workbenches

Language Extension and Composition with Language Workbenches Language Extension and Composition with Language Workbenches Eelco Visser TU Delft E.Visser@tudelft.nl Markus Voelter Independent/itemis voelter@acm.org Different Worlds Programming Tools!= Modeling Tools

More information

SMURF Language Reference Manual Serial MUsic Represented as Functions

SMURF Language Reference Manual Serial MUsic Represented as Functions SMURF Language Reference Manual Serial MUsic Represented as Functions Richard Townsend, Lianne Lairmore, Lindsay Neubauer, Van Bui, Kuangya Zhai {rt2515, lel2143, lan2135, vb2363, kz2219}@columbia.edu

More information

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview COMP 181 Compilers Lecture 2 Overview September 7, 2006 Administrative Book? Hopefully: Compilers by Aho, Lam, Sethi, Ullman Mailing list Handouts? Programming assignments For next time, write a hello,

More information

Compiler construction

Compiler construction Compiler construction Martin Steffen January 16, 2017 Contents 1 Abstract 1 1.1 Introduction............................................... 1 1.1.1 Introduction..........................................

More information

CIS 194: Homework 3. Due Wednesday, February 11, Interpreters. Meet SImPL

CIS 194: Homework 3. Due Wednesday, February 11, Interpreters. Meet SImPL CIS 194: Homework 3 Due Wednesday, February 11, 2015 Interpreters An interpreter is a program that takes another program as an input and evaluates it. Many modern languages such as Java 1, Javascript,

More information

1 Lexical Considerations

1 Lexical Considerations Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Spring 2013 Handout Decaf Language Thursday, Feb 7 The project for the course is to write a compiler

More information

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson

6.184 Lecture 4. Interpretation. Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 6.184 Lecture 4 Interpretation Tweaked by Ben Vandiver Compiled by Mike Phillips Original material by Eric Grimson 1 Interpretation Parts of an interpreter Arithmetic calculator

More information

Anatomy of a Compiler. Overview of Semantic Analysis. The Compiler So Far. Why a Separate Semantic Analysis?

Anatomy of a Compiler. Overview of Semantic Analysis. The Compiler So Far. Why a Separate Semantic Analysis? Anatomy of a Compiler Program (character stream) Lexical Analyzer (Scanner) Syntax Analyzer (Parser) Semantic Analysis Parse Tree Intermediate Code Generator Intermediate Code Optimizer Code Generator

More information

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100

Compiler Design. Computer Science & Information Technology (CS) Rank under AIR 100 GATE- 2016-17 Postal Correspondence 1 Compiler Design Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key concepts,

More information

Developing Web-Based Applications Using Model Driven Architecture and Domain Specific Languages

Developing Web-Based Applications Using Model Driven Architecture and Domain Specific Languages Proceedings of the 8 th International Conference on Applied Informatics Eger, Hungary, January 27 30, 2010. Vol. 2. pp. 287 293. Developing Web-Based Applications Using Model Driven Architecture and Domain

More information

Parser Design. Neil Mitchell. June 25, 2004

Parser Design. Neil Mitchell. June 25, 2004 Parser Design Neil Mitchell June 25, 2004 1 Introduction A parser is a tool used to split a text stream, typically in some human readable form, into a representation suitable for understanding by a computer.

More information

RECODER - The Architecture of a Refactoring System

RECODER - The Architecture of a Refactoring System RECODER - The Architecture of a Refactoring System Andreas Ludwig Prof. U. Aßmann http://recoder.sf.net Overview ➊Programming in the Large Problems, Concepts, The Approach ➋The Architecture of RECODER

More information

7. Relational Calculus (Part I) 7.1 Introduction

7. Relational Calculus (Part I) 7.1 Introduction 7. Relational Calculus (Part I) 7.1 Introduction We established earlier the fundamental role of relational algebra and calculus in relational databases (see 5.1). More specifically, relational calculus

More information

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures

CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures CSE413: Programming Languages and Implementation Racket structs Implementing languages with interpreters Implementing closures Dan Grossman Fall 2014 Hi! I m not Hal J I love this stuff and have taught

More information

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018

CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures. Dan Grossman Autumn 2018 CSE341: Programming Languages Lecture 17 Implementing Languages Including Closures Dan Grossman Autumn 2018 Typical workflow concrete syntax (string) "(fn x => x + x) 4" Parsing Possible errors / warnings

More information

1. Write two major differences between Object-oriented programming and procedural programming?

1. Write two major differences between Object-oriented programming and procedural programming? 1. Write two major differences between Object-oriented programming and procedural programming? A procedural program is written as a list of instructions, telling the computer, step-by-step, what to do:

More information

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009

CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009 CSCI B522 Lecture 11 Naming and Scope 8 Oct, 2009 Lecture notes for CS 6110 (Spring 09) taught by Andrew Myers at Cornell; edited by Amal Ahmed, Fall 09. 1 Static vs. dynamic scoping The scope of a variable

More information

CS61A Discussion Notes: Week 11: The Metacircular Evaluator By Greg Krimer, with slight modifications by Phoebus Chen (using notes from Todd Segal)

CS61A Discussion Notes: Week 11: The Metacircular Evaluator By Greg Krimer, with slight modifications by Phoebus Chen (using notes from Todd Segal) CS61A Discussion Notes: Week 11: The Metacircular Evaluator By Greg Krimer, with slight modifications by Phoebus Chen (using notes from Todd Segal) What is the Metacircular Evaluator? It is the best part

More information

MIDTERM EXAM (Solutions)

MIDTERM EXAM (Solutions) MIDTERM EXAM (Solutions) Total Score: 100, Max. Score: 83, Min. Score: 26, Avg. Score: 57.3 1. (10 pts.) List all major categories of programming languages, outline their definitive characteristics and

More information

Principles of Programming Languages

Principles of Programming Languages Principles of Programming Languages www.cs.bgu.ac.il/~ppl172 Lesson 6 - Defining a Programming Language Bottom Up Collaboration and Management - Elements of Programming Dana Fisman 1 What we accomplished

More information

Monads. Mark Hills 6 August Department of Computer Science University of Illinois at Urbana-Champaign

Monads. Mark Hills 6 August Department of Computer Science University of Illinois at Urbana-Champaign Monads Mark Hills mhills@cs.uiuc.edu Department of Computer Science University of Illinois at Urbana-Champaign 6 August 2009 Hills Monads 1 / 19 Overview Overview Hills Monads 2 / 19 Why Monads? Overview

More information

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via by Friday, Mar. 18, 2016

Math Dr. Miller - Constructing in Sketchpad (tm) - Due via  by Friday, Mar. 18, 2016 Math 304 - Dr. Miller - Constructing in Sketchpad (tm) - Due via email by Friday, Mar. 18, 2016 As with our second GSP activity for this course, you will email the assignment at the end of this tutorial

More information

Chapter 1. Fundamentals of Higher Order Programming

Chapter 1. Fundamentals of Higher Order Programming Chapter 1 Fundamentals of Higher Order Programming 1 The Elements of Programming Any powerful language features: so does Scheme primitive data procedures combinations abstraction We will see that Scheme

More information

PROBLEM SOLVING AND PYTHON PROGRAMMING

PROBLEM SOLVING AND PYTHON PROGRAMMING ALGORITHM UNIT-1 It is defined as a sequence of instructions that describe a method for solving a problem. In other words it is a step by step procedure for solving a problem. Properties of Algorithms

More information

Chapter 2 A Quick Tour

Chapter 2 A Quick Tour Chapter 2 A Quick Tour 2.1 The Compiler Toolchain A compiler is one component in a toolchain of programs used to create executables from source code. Typically, when you invoke a single command to compile

More information

Lists. Michael P. Fourman. February 2, 2010

Lists. Michael P. Fourman. February 2, 2010 Lists Michael P. Fourman February 2, 2010 1 Introduction The list is a fundamental datatype in most functional languages. ML is no exception; list is a built-in ML type constructor. However, to introduce

More information

COMP-520 GoLite Tutorial

COMP-520 GoLite Tutorial COMP-520 GoLite Tutorial Alexander Krolik Sable Lab McGill University Winter 2019 Plan Target languages Language constructs, emphasis on special cases General execution semantics Declarations Types Statements

More information

Inheritance Metrics: What do they Measure?

Inheritance Metrics: What do they Measure? Inheritance Metrics: What do they Measure? G. Sri Krishna and Rushikesh K. Joshi Department of Computer Science and Engineering Indian Institute of Technology Bombay Mumbai, 400 076, India Email:{srikrishna,rkj}@cse.iitb.ac.in

More information

Jeremy G. Siek and Erik Silkensen Composable DSLs 1 / 28

Jeremy G. Siek and Erik Silkensen Composable DSLs 1 / 28 Composable DSLs Jeremy G. Siek and Erik Silkensen IFIP WG 2.11, September 2011 Jeremy G. Siek and Erik Silkensen Composable DSLs 1 / 28 Our World of Interacting DSLs Sets Regular Expressions SQL Yacc Application

More information

Technical aspects of VTL to SQL translation Prepared by Regional Statistical Office in Olsztyn, Poland

Technical aspects of VTL to SQL translation Prepared by Regional Statistical Office in Olsztyn, Poland Working Paper. UNITED NATIONS ECONOMIC COMMISSION FOR EUROPE CONFERENCE OF EUROPEAN STATISTICIANS Work Session on Statistical Data Editing (The Hague, Netherlands, 24-26 April 2017) I. Introduction A.

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 3 Thomas Wies New York University Review Last week Names and Bindings Lifetimes and Allocation Garbage Collection Scope Outline Control Flow Sequencing

More information

CS 11 Haskell track: lecture 1

CS 11 Haskell track: lecture 1 CS 11 Haskell track: lecture 1 This week: Introduction/motivation/pep talk Basics of Haskell Prerequisite Knowledge of basic functional programming e.g. Scheme, Ocaml, Erlang CS 1, CS 4 "permission of

More information

HKALE 2012 ASL Computer Applications Paper 2 Disscussion forum system

HKALE 2012 ASL Computer Applications Paper 2 Disscussion forum system HKALE 2012 ASL Computer Applications Paper 2 Disscussion forum system Yan Chai Hospital Lim Por Yen Secondary School 7A(3) Chu Chun Kit CONTENT PAGE 1. Content Page P.1 2. Schedule P.2 3. Objective P.3-4

More information

Programming Languages Third Edition. Chapter 7 Basic Semantics

Programming Languages Third Edition. Chapter 7 Basic Semantics Programming Languages Third Edition Chapter 7 Basic Semantics Objectives Understand attributes, binding, and semantic functions Understand declarations, blocks, and scope Learn how to construct a symbol

More information

Syntax. A. Bellaachia Page: 1

Syntax. A. Bellaachia Page: 1 Syntax 1. Objectives & Definitions... 2 2. Definitions... 3 3. Lexical Rules... 4 4. BNF: Formal Syntactic rules... 6 5. Syntax Diagrams... 9 6. EBNF: Extended BNF... 10 7. Example:... 11 8. BNF Statement

More information

Lecture 19: Signatures, Structures, and Type Abstraction

Lecture 19: Signatures, Structures, and Type Abstraction 15-150 Lecture 19: Signatures, Structures, and Type Abstraction Lecture by Dan Licata March 27, 2012 In these lectures, we will discuss the use of the ML module system for structuring large programs. Key

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

Module 27 Switch-case statements and Run-time storage management

Module 27 Switch-case statements and Run-time storage management Module 27 Switch-case statements and Run-time storage management In this module we will discuss the pending constructs in generating three-address code namely switch-case statements. We will also discuss

More information

SERG. Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT

SERG. Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT Delft University of Technology Software Engineering Research Group Technical Report Series Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT Karl Trygve

More information

Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming

Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming Written Presentation: JoCaml, a Language for Concurrent Distributed and Mobile Programming Nicolas Bettenburg 1 Universitaet des Saarlandes, D-66041 Saarbruecken, nicbet@studcs.uni-sb.de Abstract. As traditional

More information

easel LANGUAGE REFERENCE MANUAL

easel LANGUAGE REFERENCE MANUAL easel LANGUAGE REFERENCE MANUAL Manager Danielle Crosswell dac2182 Language Guru Tyrus Cukavac thc2125 System Architect Yuan-Chao Chou yc3211 Tester Xiaofei Chen xc2364 Table of Contents 1. Introduction...

More information

UPTR - a simple parse tree representation format

UPTR - a simple parse tree representation format UPTR - a simple parse tree representation format Jurgen Vinju Software Transformation Systems October 22, 2006 Quality of Software Transformation Systems Some Questions on Parsing Two pragmatical steps

More information

INF5110 Compiler Construction

INF5110 Compiler Construction INF5110 Compiler Construction Introduction Spring 2016 1 / 33 Outline 1. Introduction Introduction Compiler architecture & phases Bootstrapping and cross-compilation 2 / 33 Outline 1. Introduction Introduction

More information

Code Structure Visualization

Code Structure Visualization TECHNISCHE UNIVERSITEIT EINDHOVEN Department of Mathematics and Computer Science MASTER S THESIS Code Structure Visualization by G.L.P.M. Lommerse Supervisor: Dr. Ir. A.C. Telea (TUE) Eindhoven, August

More information

Compiler construction

Compiler construction Compiler construction Martin Steffen March 13, 2017 Contents 1 Abstract 1 1.1 Symbol tables. 1 1.1.1 Introduction 1 1.1.2 Symbol table design and interface.. 2 1.1.3 Implementing symbol tables 3 1.1.4

More information

A Small Permutation Group Engine by: Gregory Kip. COMS W4115 Programming Languages and Translators Prof. Stephen Edwards

A Small Permutation Group Engine by: Gregory Kip. COMS W4115 Programming Languages and Translators Prof. Stephen Edwards µperm A Small Permutation Group Engine by: Gregory Kip COMS W4115 Programming Languages and Translators Prof. Stephen Edwards Abstract Given the abstract character of much of modern physics and mathematics,

More information

The Relationships between Domain Specific and General- Purpose Languages

The Relationships between Domain Specific and General- Purpose Languages The Relationships between Domain Specific and General- Purpose Languages Oded Kramer and Arnon Sturm Department of Information Systems Engineering, Ben-Gurion University of the Negev Beer-Sheva, Israel

More information

Program generation for schema-based, typed data access

Program generation for schema-based, typed data access Program generation for schema-based, typed data access Ralf Lämmel Software Engineer Facebook, London Program generation A use case at Facebook Purpose of generation: typed data access ("O/R mapping" et

More information

First Java Program - Output to the Screen

First Java Program - Output to the Screen First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the

More information

Operational Semantics. One-Slide Summary. Lecture Outline

Operational Semantics. One-Slide Summary. Lecture Outline Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:

More information

Programming Languages 2nd edition Tucker and Noonan"

Programming Languages 2nd edition Tucker and Noonan Programming Languages 2nd edition Tucker and Noonan" " Chapter 1" Overview" " A good programming language is a conceptual universe for thinking about programming. " " " " " " " " " " " " "A. Perlis" "

More information

Names, Scope, and Bindings

Names, Scope, and Bindings Names, Scope, and Bindings COMS W4115 Prof. Stephen A. Edwards Spring 2007 Columbia University Department of Computer Science What s In a Name? Name: way to refer to something else variables, functions,

More information

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages

Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 18 Thursday, March 29, 2018 In abstract algebra, algebraic structures are defined by a set of elements and operations

More information

Writing Evaluators MIF08. Laure Gonnord

Writing Evaluators MIF08. Laure Gonnord Writing Evaluators MIF08 Laure Gonnord Laure.Gonnord@univ-lyon1.fr Evaluators, what for? Outline 1 Evaluators, what for? 2 Implementation Laure Gonnord (Lyon1/FST) Writing Evaluators 2 / 21 Evaluators,

More information

Syntax and Grammars 1 / 21

Syntax and Grammars 1 / 21 Syntax and Grammars 1 / 21 Outline What is a language? Abstract syntax and grammars Abstract syntax vs. concrete syntax Encoding grammars as Haskell data types What is a language? 2 / 21 What is a language?

More information

This book is licensed under a Creative Commons Attribution 3.0 License

This book is licensed under a Creative Commons Attribution 3.0 License 6. Syntax Learning objectives: syntax and semantics syntax diagrams and EBNF describe context-free grammars terminal and nonterminal symbols productions definition of EBNF by itself parse tree grammars

More information

Modularly Programmable Syntax

Modularly Programmable Syntax Modularly Programmable Syntax Cyrus Omar Jonathan Aldrich Computer Science Department Carnegie Mellon University [CMU POP Retreat 2015] List Syntax DERIVED FORM [1, 2, 3, 4, 5] EXPANSION Cons(1, Cons(2,

More information

CA Compiler Construction

CA Compiler Construction CA4003 - Compiler Construction Semantic Analysis David Sinclair Semantic Actions A compiler has to do more than just recognise if a sequence of characters forms a valid sentence in the language. It must

More information

Towards semantic merging of versions of BDI agent systems

Towards semantic merging of versions of BDI agent systems Towards semantic merging of versions of BDI agent systems Yingzhi Gou, Hoa Khanh Dam and Aditya Ghose School of Computer Science and Software Engineering University of Wollongong New South Wales 2522,

More information

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine.

1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 1. true / false By a compiler we mean a program that translates to code that will run natively on some machine. 2. true / false ML can be compiled. 3. true / false FORTRAN can reasonably be considered

More information

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram

SYED AMMAL ENGINEERING COLLEGE (An ISO 9001:2008 Certified Institution) Dr. E.M. Abdullah Campus, Ramanathapuram CS6660 COMPILER DESIGN Question Bank UNIT I-INTRODUCTION TO COMPILERS 1. Define compiler. 2. Differentiate compiler and interpreter. 3. What is a language processing system? 4. List four software tools

More information

Outline. What is semantics? Denotational semantics. Semantics of naming. What is semantics? 2 / 21

Outline. What is semantics? Denotational semantics. Semantics of naming. What is semantics? 2 / 21 Semantics 1 / 21 Outline What is semantics? Denotational semantics Semantics of naming What is semantics? 2 / 21 What is the meaning of a program? Recall: aspects of a language syntax: the structure of

More information

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited

Topics Covered Thus Far. CMSC 330: Organization of Programming Languages. Language Features Covered Thus Far. Programming Languages Revisited CMSC 330: Organization of Programming Languages Type Systems, Names & Binding Topics Covered Thus Far Programming languages Syntax specification Regular expressions Context free grammars Implementation

More information

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5

C++ Data Types. 1 Simple C++ Data Types 2. 3 Numeric Types Integers (whole numbers) Decimal Numbers... 5 C++ Data Types Contents 1 Simple C++ Data Types 2 2 Quick Note About Representations 3 3 Numeric Types 4 3.1 Integers (whole numbers)............................................ 4 3.2 Decimal Numbers.................................................

More information

Extended abstract. The Pivot: A brief overview

Extended abstract. The Pivot: A brief overview Extended abstract The Pivot: A brief overview Bjarne Stroustrup and Gabriel Dos Reis bs@cs.tamu.edu, gdr@cs.tamu.edu Abstract This paper introduces the Pivot, a general framework for the analysis and transformation

More information

Better Extensibility through Modular Syntax. Robert Grimm New York University

Better Extensibility through Modular Syntax. Robert Grimm New York University Better Extensibility through Modular Syntax Robert Grimm New York University Syntax Matters More complex syntactic specifications Extensions to existing programming languages Transactions, event-based

More information

A brief introduction to C programming for Java programmers

A brief introduction to C programming for Java programmers A brief introduction to C programming for Java programmers Sven Gestegård Robertz September 2017 There are many similarities between Java and C. The syntax in Java is basically

More information

11/6/17. Functional programming. FP Foundations, Scheme (2) LISP Data Types. LISP Data Types. LISP Data Types. Scheme. LISP: John McCarthy 1958 MIT

11/6/17. Functional programming. FP Foundations, Scheme (2) LISP Data Types. LISP Data Types. LISP Data Types. Scheme. LISP: John McCarthy 1958 MIT Functional programming FP Foundations, Scheme (2 In Text: Chapter 15 LISP: John McCarthy 1958 MIT List Processing => Symbolic Manipulation First functional programming language Every version after the

More information

Names, Scope, and Bindings

Names, Scope, and Bindings Names, Scope, and Bindings COMS W4115 Prof. Stephen A. Edwards Fall 2007 Columbia University Department of Computer Science What s In a Name? Name: way to refer to something else variables, functions,

More information

WELCOME! (download slides and.py files and follow along!) LECTURE 1

WELCOME! (download slides and.py files and follow along!) LECTURE 1 WELCOME! (download slides and.py files and follow along!) 6.0001 LECTURE 1 6.0001 LECTURE 1 1 TODAY course info what is computation python basics mathematical operations python variables and types NOTE:

More information

Handout 10: Imperative programs and the Lambda Calculus

Handout 10: Imperative programs and the Lambda Calculus 06-02552 Princ of Progr Languages (and Extended ) The University of Birmingham Spring Semester 2016-17 School of Computer Science c Uday Reddy2016-17 Handout 10: Imperative programs and the Lambda Calculus

More information

Chapter 1. Preliminaries

Chapter 1. Preliminaries Chapter 1 Preliminaries Chapter 1 Topics Reasons for Studying Concepts of Programming Languages Programming Domains Language Evaluation Criteria Influences on Language Design Language Categories Language

More information

CSCE 314 Programming Languages. Type System

CSCE 314 Programming Languages. Type System CSCE 314 Programming Languages Type System Dr. Hyunyoung Lee 1 Names Names refer to different kinds of entities in programs, such as variables, functions, classes, templates, modules,.... Names can be

More information

Functional Programming. Big Picture. Design of Programming Languages

Functional Programming. Big Picture. Design of Programming Languages Functional Programming Big Picture What we ve learned so far: Imperative Programming Languages Variables, binding, scoping, reference environment, etc What s next: Functional Programming Languages Semantics

More information

Alloy: A Lightweight Object Modelling Notation

Alloy: A Lightweight Object Modelling Notation Alloy: A Lightweight Object Modelling Notation Daniel Jackson, ACM Transactions on Software Engineering, 2002 Presented By: Steven Stewart, 2012-January-23 1 Alloy: 2002 to present Software is built on

More information

CS1102: What is a Programming Language?

CS1102: What is a Programming Language? CS1102: What is a Programming Language? Kathi Fisler, WPI September 13, 2007 1 The Design and Programming Perspectives To start to understand what comprises a programming language, let s consider sample

More information

Static Semantics. Winter /3/ Hal Perkins & UW CSE I-1

Static Semantics. Winter /3/ Hal Perkins & UW CSE I-1 CSE 401 Compilers Static Semantics Hal Perkins Winter 2009 2/3/2009 2002-09 Hal Perkins & UW CSE I-1 Agenda Static semantics Types Symbol tables General ideas for now; details later for MiniJava project

More information

Typing Data. Chapter Recursive Types Declaring Recursive Types

Typing Data. Chapter Recursive Types Declaring Recursive Types Chapter 27 Typing Data 27.1 Recursive Types 27.1.1 Declaring Recursive Types We saw in the previous lecture how rec was necessary to write recursive programs. But what about defining recursive types? Recursive

More information

Functional Parsing A Multi-Lingual Killer- Application

Functional Parsing A Multi-Lingual Killer- Application RIT Scholar Works Presentations and other scholarship 2008 Functional Parsing A Multi-Lingual Killer- Application Axel-Tobias Schreiner James Heliotis Follow this and additional works at: http://scholarworks.rit.edu/other

More information

CS Exam #1-100 points Spring 2011

CS Exam #1-100 points Spring 2011 CS 4700 - Exam #1-100 points Spring 2011 Fill in the blanks (1 point each) 1. syntactic sugar is a term coined for additions to the syntax of a computer language that do not affect its expressiveness but

More information