Interactive Disambiguation of Meta Programs with Concrete Object Syntax
|
|
- Barry Owens
- 5 years ago
- Views:
Transcription
1 Interactive Disambiguation of Meta Programs with Concrete Object Syntax Lennart Kats Karl T. Kalleberg Eelco Visser (TUDelft) (KolibriFX) (TUDelft)
2 Meta-programming
3 Meta-programming with Template Engines <<FOREACH... AS class>> <<FILE "samples/petclinic/" + class.name + ".java">> package samples.petclinic; publc class <<class.name>> { private long id; public void setid(long id) { this.id = id; public long getid() { return id; <<ENDFILE>> <<ENDFOREACH>> Easy to read, Easy to write Works for any language! Works for any lanugage! Only code generation Lack of compositionality
4 Meta-programming with Abstract Syntax for (Output c :...) { CompilationUnit u = newcompilationunit( "samples/petclinic/" + c.name + ".java"); u.setpackagename("samples.petclinic"); ClassDec cd = u.newclassdec(c.name); cd.newfield(private, long.class, "id"); MethodDec m = cd.newmethod(public, void.class, "setid"); m.newparameter(long.class, "id"); m.newstatement(newassign(newfieldaccess(this, "id"), newvariableaccess("id"))); Always wellformed! Further transformation still possible m = cd.newmethod(public, long.class, "getid"); m.newstatement(newreturn(newvariableaccess("id")));... Hard to read, Hard to write Highly verbose
5 Meta-programming with Concrete Object Syntax [Visser, GPCE 02] for (Output c :...) { CompilationUnit u = [ package samples.petclinic; Any meta language (here: Java) ]... publc class $[c.name] { private long id; public void setid(long id) { this.id = id; public long getid() { return id; Any object language (here: Java) Always wellformed!
6 for (Output c :...) { CompilationUnit u = [ package samples.petclinic; ]... Meta-programming with Concrete Object Syntax [Visser, GPCE 02] Any meta language (here: Java) public class $[c.name] { private long id; public void setid(long id) { this.id = id; for (Output c :...) { public long CompilationUnit getid() { u = return id; newcompilationunit( "samples/petclinic/" + c.name + ".java"); u.setpackagename("samples.petclinic"); Transform Easy to read, Easy to write(?) Further Any object language transformation (here: Java) still possible ClassDec cd = u.newclassdec(c.name); cd.newfield(private, long.class, "id"); MethodDec m = cd.newmethod(public, void.class, "setid"); m.newparameter(long.class, "id"); m.newstatement(newassign(newfieldaccess (THIS, "id"), newvariableaccess("id")));
7 Prerequisites Parser for meta language + object language created using grammar composition: meta language grammar object language grammar mixin grammar for quotations and antiquotations
8 Example SDF Mixin Grammar module Stratego-Java imports Stratego Java exports context-free syntax " [" ClassDec "] " -> Term " [" CompUnit "] " -> Term " [" BlockStm "] " -> Term {cons("tometaexpr") {cons("tometaexpr") {cons("tometaexpr") "$[" Term "]" -> ClassDec "$[" Term "]" -> BlockStm "$[" Term "]" -> CompUnit {cons("frommetaexpr") {cons("frommetaexpr") {cons("frommetaexpr")
9 Problem: Ambiguity [ class X { Which is it? ] exports context-free syntax " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr")
10 Problem: Ambiguity class X { class Y { Which is it? Just another class? exports context-free syntax " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr")
11 Problem: Ambiguity class X { Which is it? Just another class? A compilation unit? exports context-free syntax " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr")
12 Problem: Ambiguity void foo () { class X { Which is it? Just another class? A compilation unit? exports context-free syntax Or a class declaration statement? " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr")
13 Problem: Ambiguity [ class X { Which is it? ] Just another class? A compilation unit? Or a class declaration statement? exports context-free syntax " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr")
14 Disambiguation
15 Tag-based Disambiguation "ClassDec" "CompUnit" "BlockStm" " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr") Simple, generic CompUnit [ class Foo { ] Verbose Need to know the tag names
16 Type-based Disambiguation [Bravenboer et al. 05, Vinju 05] More concise! CompUnit c = [ class Foo { ] ; foomethod( [ class Foo { ] ); Need to know the type names Requires special type checker Often relies on heuristics
17 Interactive Disambiguation Addresses discovery issue Complementary approach
18 1. User writes meta program,
19 Parsing with Ambiguity, " [" ConstantDec "] " -> Term {cons("tometaexpr") " [" LocalVarDecStm "] " -> Term {cons("tometaexpr") " [" FieldDec "] " -> Term {cons("tometaexpr") Parse forest from generalized parser (SGLR): amb ToMetaExpr ToMetaExpr ToMetaExpr Constant Dec LocalVar DecStm FieldDec
20 2. IDE detects ambiguity
21 3. User selects intention
22 4. IDE explicitly disambiguates meta program Simple, generic Addresses name discovery No heuristics
23 Mixin Grammar for Interactive Disambiguation Discovery " [" ClassDec "] " -> Term {cons("tometaexpr") " [" CompUnit "] " -> Term {cons("tometaexpr") " [" BlockStm "] " -> Term {cons("tometaexpr") "ClassDec" " [" ClassDec "] " -> Term {cons("tometaexpr") "CompUnit" " [" CompUnit "] " -> Term {cons("tometaexpr") "BlockStm" " [" BlockStm "] " -> Term {cons("tometaexpr") Disambiguation
24 Perspective Here, applied with tag-based disambiguation Also useful with type-based disambiguation Get rid of heuristics Different transformations needed
25 Perspective Link to projectional editing
26 Conclusion Leverage IDE Useful for meta programs. Programs also? Addresses discovery issue Avoids heuristics
Domain-Specific Languages for Composable Editor Plugins
Domain-Specific Languages for Composable Editor Plugins LDTA 2009, York, UK Lennart Kats (me), Delft University of Technology Karl Trygve Kalleberg, University of Bergen Eelco Visser, Delft University
More informationGeneralized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax
Generalized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax GPCE 2005 Martin Bravenboer, Rob Vermaas, Jurgen Vinju and Eelco Visser Department of Information & Computing Sciences
More informationGeneralized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax. Martin Bravenboer Rob Vermaas Jurgen Vinju Eelco Visser
Generalized Type-Based Disambiguation of Meta Programs with Concrete Object Syntax Martin Bravenboer Rob Vermaas Jurgen Vinju Eelco Visser Technical Report UU-CS-2005-035 Institute of Information and Computing
More informationRenaud Durlin. May 16, 2007
A comparison of different approaches EPITA Research and Development Laboratory (LRDE) http://www.lrde.epita.fr May 16, 2007 1 / 25 1 2 3 4 5 2 / 25 1 2 3 4 5 3 / 25 Goal Transformers:
More informationSERG. 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 informationSemantics driven disambiguation A comparison of different approaches
Semantics driven disambiguation A comparison of different approaches Clément Vasseur Technical Report n o 0416, 12 2004 revision 656 Context-free grammars allow the specification
More informationSEN. Software Engineering. Software ENgineering. A type-driven approach to concrete meta programming. J.J. Vinju
C e n t r u m v o o r W i s k u n d e e n I n f o r m a t i c a SEN Software Engineering Software ENgineering A type-driven approach to concrete meta programming J.J. Vinju REPORT SEN-E0507 APRIL 2005
More informationSERG. Natural and Flexible Error Recovery for Generated Modular Language Environments
Delft University of Technology Software Engineering Research Group Technical Report Series Natural and Flexible Error Recovery for Generated Modular Language Environments Maartje de Jonge, Lennart C.L.
More informationSpoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT
Spoofax: An Extensible, Interactive Development Environment for Program Transformation with Stratego/XT Karl Trygve Kalleberg 1 Department of Informatics, University of Bergen, P.O. Box 7800, N-5020 BERGEN,
More informationSERG. Domain-Specific Languages for Composable Editor Plugins
Delft University of Technology Software Engineering Research Group Technical Report Series Domain-Specific Languages for Composable Editor Plugins Lennart C. L. Kats, Karl T. Kalleberg, Eelco Visser Report
More informationInfrastructure for Program Transformation Systems
Master Course Program Transformation 2004-2005 Martin Bravenboer Institute of Information & Computing Sciences Utrecht University, The Netherlands February 10, 2005 Planet Stratego/XT Stratego Language
More informationTowards Intelligent Coding Assistance for Code Generation in Modeling Frameworks
Towards Intelligent Coding Assistance for Code Generation in Modeling Frameworks Martin Bravenboer Software Engineering Research Group Department of Software Technology Delft University of Technology The
More informationDomain-Specific Languages for Composable Editor Plugins
Electronic Notes in Theoretical Computer Science 253 (2010) 149 163 www.elsevier.com/locate/entcs Domain-Specific Languages for Composable Editor Plugins Lennart C. L. Kats,1,2 Karl T. Kalleberg +,3 Eelco
More informationConcrete Syntax for Objects
Realizing Domain-Specific Language Embedding and Assimilation without Restrictions Martin Bravenboer Eelco Visser Institute of Information & Computing Sciences Utrecht University, The Netherlands June
More informationIncremental parsing C++ pre-processing
Incremental parsing C++ pre-processing Olivier Gournet LRDE seminar, June 16, 2004 http://www.lrde.epita.fr/ Copying this document Copying this document Copyright c 2004
More informationStratego/XT 0.16: Components for Transformation Systems
Stratego/XT 0.16: Components for Transformation Systems Martin Bravenboer Department of Information and Computing Sciences, Utrecht University martin@cs.uu.nl Karl Trygve Kalleberg Department of Informatics
More informationStratego/XT 0.16: Components for Transformation Systems
Stratego/XT 0.16: Components for Transformation Systems Martin Bravenboer Karl Trygve Kalleberg Rob Vermaas Eelco Visser Technical Report UU-CS-2005-052 Department of Information and Computing Sciences
More informationJeremy 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 informationDeclarative Language Definition
Declarative Language Definition (state-of-the-art & research agenda) Eelco Visser http://eelcovisser.org IPA Spring Days 2012 Garderen, Netherlands Software Engineering Problem Domain Machine bridging
More informationXML Processing and Term Rewriting
XML Processing and Term Rewriting Martin Bravenboer martin@cs.uu.nl Institute of Information and Computing Sciences, University Utrecht, The Netherlands xml processing and term rewriting p.1/39 contents
More informationUPTR - 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 informationConcrete Syntax for Objects
Concrete Syntax for Objects Domain-Specific Language Embedding and Assimilation without Restrictions Martin Bravenboer Institute of Information and Computing Sciences Universiteit Utrecht, P.O. Box 80089
More informationSemantics driven disambiguation
Semantics driven disambiguation Renaud Durlin Technical Report n o 0709, June 13, 2008 revision 1464 BibTeX reference: durlin.07.seminar An elegant approach to manage ambiguous grammars consists in using
More informationEclipse and Java 8. Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab
Eclipse and Java 8 Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab Eclipse and Java 8 New Java language features Eclipse features for Java 8 (demo) Behind the scenes
More informationAttribute grammars for C++ disambiguation
Attribute grammars for C++ disambiguation Valentin David Technical Report n o 0405, December 2004 revision 667 The development of the Transformers project has raised some design
More informationThe Syntax Definition Formalism SDF
Mark van den Brand Paul Klint Jurgen Vinju 2007-10-22 17:18:09 +0200 (Mon, 22 Oct 2007) Table of Contents An Introduction to SDF... 2 Why use SDF?... 2 How to use SDF... 4 Learning more... 4 This document...
More informationChair of Software Engineering. Languages in Depth Series: Java Programming. Prof. Dr. Bertrand Meyer. Exercise Session 3
Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Exercise Session 3 Today s Exercise Session Assignment 2 Walkthrough the master solution (your solutions)
More informationSpoofax: A Development Environment for Software Transformations. Karl Trygve Kalleberg University of Bergen
Spoofax: A Development Environment for Software Transformations Karl Trygve Kalleberg University of Bergen Prerequisites Rudimentary programming skills Some familiarity with non-linear storytelling Basic
More informationThe Meta-Environment. A Language Workbench for Source code Analysis, Visualization and Transformation. Jurgen Vinju IPA herfstdagen 2008
The Meta-Environment A Language Workbench for Source code Analysis, Visualization and Transformation Jurgen Vinju IPA herfstdagen 2008 Overview Goal of The Meta-Environment Methods of The Meta-Environment
More informationSemantic Analysis. Compiler Architecture
Processing Systems Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Source Compiler Architecture Front End Scanner (lexical tokens Parser (syntax Parse tree Semantic Analysis
More informationBuilding an IDE with Rascal
Building an IDE with Rascal Mark Hills CWI & INRIA ATEAMS 18 May 2011 Hills Building an IDE with Rascal 1/23 Outline Setting the Stage 1 Setting the Stage Hills Building an IDE with Rascal 2/23 Outline
More informationSPIN s Promela to Java Compiler, with help from Stratego
SPIN s Promela to Java Compiler, with help from Stratego Master s Thesis Edwin Vielvoije SPIN s Promela to Java Compiler, with help from Stratego THESIS submitted in partial fulfillment of the requirements
More informationDisambiguation Filters for Scannerless Generalized LR Parsers
Disambiguation Filters for Scannerless Generalized LR Parsers Mark G. J. van den Brand 1,4, Jeroen Scheerder 2, Jurgen J. Vinju 1, and Eelco Visser 3 1 Centrum voor Wiskunde en Informatica (CWI) Kruislaan
More informationGrammars and Parsing, second week
Grammars and Parsing, second week Hayo Thielecke 17-18 October 2005 This is the material from the slides in a more printer-friendly layout. Contents 1 Overview 1 2 Recursive methods from grammar rules
More informationExercises in Free Syntax
Exercises in Free Syntax Syntax Definition, Parsing, and Assimilation of Language Conglomerates Exercities in vrije syntax Syntax definitie, ontleding, en assimilatie van taalagglomeraten (met een samenvatting
More informationBetter 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 informationModules: ADL & Internal Linkage
Document Number: p1347r1 Date: 2019-01-17 To: SC22/WG21 EWG Reply to: Davis Herring, Nathan Sidwell herring@lanl.gov, nathan@acm.org Re: p1103r1 Merging Modules Modules: ADL & Internal Linkage Nathan Sidwell,
More informationProf. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan
Language Processing Systems Prof. Mohamed Hamada Software Engineering Lab. The University of Aizu Japan Semantic Analysis Compiler Architecture Front End Back End Source language Scanner (lexical analysis)
More informationarxiv: v1 [cs.pl] 21 Jan 2013
A DSL for Mapping Abstract Syntax Models to Concrete Syntax Models in ModelCC Luis Quesada, Fernando Berzal, and Juan-Carlos Cubero Department Computer Science and Artificial Intelligence, CITIC, University
More informationSERG. Integrated Language Definition Testing: Enabling Test-Driven Language Development
Delft University of Technology Software Engineering Research Group Technical Report Series Integrated Language Definition Testing: Enabling Test-Driven Language Development Lennart C. L. Kats, Rob Vermaas,
More information... is a Programming Environment (PE)?... is Generic Language Technology (GLT)?
Introduction to Generic Language Technology Today Mark van den Brand Paul Klint Jurgen Vinju Tools for software analysis and manipulation Programming language independent (parametric) The story is from
More informationLayout-sensitive Generalized Parsing
Layout-sensitive Generalized Parsing Sebastian Erdweg, Tillmann Rendel, Christian Kästner, and Klaus Ostermann University of Marburg, Germany Abstract. The theory of context-free languages is well-understood
More informationGrammar Engineering Support for Precedence Rule Recovery and Compatibility Checking
Electronic Notes in Theoretical Computer Science 203 (2008) 85 101 www.elsevier.com/locate/entcs Grammar Engineering Support for Precedence Rule Recovery and Compatibility Checking Eric Bouwers a,1 Martin
More informationDomain Specific - a Binary Decision?
Domain Specific - a Binary Decision? Markus Voelter independent/itemis Ötztaler Strasse 38 70327 Stuttgart, Germany voelter@acm.org Bernhard Merkle SICK AG R&D Software Engineering Erwin-Sick-Str.1 79183
More informationLanguage-Parametric Techniques for Language-Specific Editors
Language-Parametric Techniques for Language-Specific Editors PROEFSCHRIFT ter verkrijging van de graad van doctor aan de Technische Universiteit Delft, op gezag van de Rector Magnificus prof. ir. K.C.A.M.
More informationbuilding DSLs with language workbenches
ThoughtWorks building DSLs with language workbenches NEAL FORD software architect / meme wrangler ThoughtWorks nford@thoughtworks.com 3003 Summit Boulevard, Atlanta, GA 30319 www.nealford.com www.thoughtworks.com
More informationCitation for published version (APA): Basten, H. J. S. (2011). Ambiguity detection for programming language grammars
UvA-DARE (Digital Academic Repository) Ambiguity detection for programming language grammars Basten, H.J.S. Link to publication Citation for published version (APA): Basten, H. J. S. (2011). Ambiguity
More informationThe Art, Science, and Engineering of Programming
Luis Eduardo de Souza Amorim a, Michael J. Steindorfer a, and Eelco Visser a a Delft University of Technology, Delft, The Netherlands Abstract Context Context-free grammars are widely used for language
More informationScannerless Boolean Parsing
LDTA 2006 Preliminary Version Scannerless Boolean Parsing Adam Megacz Computer Science UC Berkeley Abstract Scannerless generalized parsing techniques allow parsers to be derived directly from unified,
More informationDeclaratively Defining Domain-Specific Language Debuggers
Declaratively Defining Domain-Specific Language Debuggers Version of July 19, 2013 Ricky T. Lindeman Declaratively Defining Domain-Specific Language Debuggers THESIS submitted in partial fulfillment of
More informationExtended 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 informationAn Evaluation of Domain-Specific Language Technologies for Code Generation
An Evaluation of Domain-Specific Language Technologies for Code Generation Christian Schmitt, Sebastian Kuckuk, Harald Köstler, Frank Hannig, Jürgen Teich Hardware/Software Co-Design, System Simulation,
More informationOutlook on Composite Type Labels in User-Defined Type Systems
34 (2017 ) Outlook on Composite Type Labels in User-Defined Type Systems Antoine Tu Shigeru Chiba This paper describes an envisioned implementation of user-defined type systems that relies on a feature
More informationLanguage 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 informationSyntax/semantics. Program <> program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing
Syntax/semantics Program program execution Compiler/interpreter Syntax Grammars Syntax diagrams Automata/State Machines Scanning/Parsing Meta-models 8/27/10 1 Program program execution Syntax Semantics
More informationDisambiguation Filters for Scannerless Generalized LR Parsers
Disambiguation Filters for Scannerless Generalized LR Parsers M.G.J. van den Brand 1,4, J. Scheerder 2, J.J. Vinju 1, and E. Visser 3 1 Centrum voor Wiskunde en Informatica (CWI), Kruislaan 413, 1098 SJ
More informationA Lightweight and Extensible AspectJ Implementation
A Lightweight and Extensible AspectJ Implementation Rodolfo Toledo Éric Tanter 1 PLEIAD Lab Computer Science Department University of Chile Santiago, Chile {rtoledo,etanter}@dcc.uchile.cl Abstract. Extending
More informationC++ template disambiguation with TRANSFORMERS Attribute Grammars
C++ template disambiguation with TRANSFORMERS Attribute Grammars Warren Seine Technical Report n o 0811, July 2008 revision 1896 English: The C++ language is context-sensitive: no context-free grammar
More informationECE251 Midterm practice questions, Fall 2010
ECE251 Midterm practice questions, Fall 2010 Patrick Lam October 20, 2010 Bootstrapping In particular, say you have a compiler from C to Pascal which runs on x86, and you want to write a self-hosting Java
More informationCOMPUTING SCIENCE 3Z: PROGRAMMING LANGUAGES 3
Tuesday, 28 May 2009 2.00 pm 3.30 pm (Duration: 1 hour 30 minutes) DEGREES OF MSci, MEng, BEng, BSc, MA and MA (Social Sciences) COMPUTING SCIENCE 3Z: PROGRAMMING LANGUAGES 3 Answer all 4 questions. This
More informationBuilding Compilers with Phoenix
Building Compilers with Phoenix Parser Generators: ANTLR History of ANTLR ANother Tool for Language Recognition Terence Parr's dissertation: Obtaining Practical Variants of LL(k) and LR(k) for k > 1 PCCTS:
More informationDisambiguation Filters for Scannerless Generalized LR Parsers
Disambiguation Filters for Scannerless Generalized LR Parsers M.G.J. van den Brand 1, J. Scheerder 2, J.J. Vinju 1, and E. Visser 3 1 Centrum voor Wiskunde en Informatica (CWI), Kruislaan 413, 1098 SJ
More informationCPS 506 Comparative Programming Languages. Syntax Specification
CPS 506 Comparative Programming Languages Syntax Specification Compiling Process Steps Program Lexical Analysis Convert characters into a stream of tokens Lexical Analysis Syntactic Analysis Send tokens
More informationPART 1. Eclipse IDE Tutorial. 1. What is Eclipse? Eclipse Java IDE
PART 1 Eclipse IDE Tutorial Eclipse Java IDE This tutorial describes the usage of Eclipse as a Java IDE. It describes the installation of Eclipse, the creation of Java programs and tips for using Eclipse.
More informationVerifiable composition of language extensions
Verifiable composition of language extensions Ted Kaminski Department of Computer Science and Engineering University of Minnesota, Minneapolis, MN, USA tedinski@cs.umn.edu Abstract. Domain-specific languages
More informationGeneralized Parsing and Term Rewriting: Semantics Driven Disambiguation
LDTA 03 Preliminary Version Generalized Parsing and Term Rewriting: Semantics Driven Disambiguation M.G.J. van den Brand 2,4, A.S. Klusener 3,4, L. Moonen 1, J.J. Vinju 1 1 Centrum voor Wiskunde en Informatica
More informationsbp: A Scannerless Boolean Parser
LDTA 2006 Preliminary Version sbp: A Scannerless Boolean Parser Adam Megacz Computer Science UC Berkeley Abstract Scannerless generalized parsing techniques allow parsers to be derived directly from unified,
More informationLECTURE 3. Compiler Phases
LECTURE 3 Compiler Phases COMPILER PHASES Compilation of a program proceeds through a fixed series of phases. Each phase uses an (intermediate) form of the program produced by an earlier phase. Subsequent
More informationCSCE 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 informationSERG. The Spoofax Language Workbench Rules for Declarative Specification of Languages and IDEs
Delft University of Technology Software Engineering Research Group Technical Report Series The Spoofax Language Workbench Rules for Declarative Specification of Languages and IDEs Lennart C. L. Kats, Eelco
More informationContext-Free Grammars
CFG2: Ambiguity Context-Free Grammars CMPT 379: Compilers Instructor: Anoop Sarkar anoopsarkar.github.io/compilers-class Ambiguity - / - / ( ) - / / - 16-06-22 2 Ambiguity Grammar is ambiguous if more
More informationCMPT 379 Compilers. Parse trees
CMPT 379 Compilers Anoop Sarkar http://www.cs.sfu.ca/~anoop 10/25/07 1 Parse trees Given an input program, we convert the text into a parse tree Moving to the backend of the compiler: we will produce intermediate
More informationImport Statements, Instance Members, and the Default Constructor
Import Statements, Instance Members, and the Default Constructor Introduction In this article from my free Java 8 course, I will be discussing import statements, instance members, and the default constructor.
More informationCSE 401 Midterm Exam Sample Solution 11/4/11
Question 1. (12 points, 2 each) The front end of a compiler consists of three parts: scanner, parser, and (static) semantics. Collectively these need to analyze the input program and decide if it is correctly
More informationCS 251 Intermediate Programming Inheritance
CS 251 Intermediate Programming Inheritance Brooke Chenoweth University of New Mexico Spring 2018 Inheritance We don t inherit the earth from our parents, We only borrow it from our children. What is inheritance?
More informationUsing 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 informationModel-Driven Engineering (MDE) Lecture 1: Metamodels and Xtext Regina Hebig, Thorsten Berger
Model-Driven Engineering (MDE) Lecture 1: Metamodels and Xtext Regina Hebig, Thorsten Berger Reuses some material from: Andrzej Wasowski, Model-Driven Development, ITU Copenhagen Where I am from WASP 2017
More informationModules:Context-Sensitive Keyword
Document Number: P0924r1 Date: 2018-11-21 To: SC22/WG21 EWG Reply to: Nathan Sidwell nathan@acm.org / nathans@fb.com Re: Merging Modules, p1103r2 Modules:Context-Sensitive Keyword Nathan Sidwell The new
More information1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail.
Code No: R05320502 Set No. 1 1. Explain the input buffer scheme for scanning the source program. How the use of sentinels can improve its performance? Describe in detail. 2. Construct predictive parsing
More informationProgram Transformation Mechanics
Program Transformation Mechanics A Classification of Mechanisms for Program Transformation with a Survey of Existing Transformation Systems Jonne van Wijngaarden Eelco Visser UU-CS-2003-048 Institute of
More informationRobert Grimm New York University
xtc Towards extensible C Robert Grimm New York University The Problem Complexity of modern systems is staggering Increasingly, a seamless, global computing environment System builders continue to use C
More informationEnhancing Xtext for General Purpose Languages
Enhancing Xtext for General Purpose Languages Adolfo Sánchez-Barbudo Herrera Department of Computer Science, University of York, UK. asbh500@york.ac.uk Abstract. Xtext is a popular language workbench conceived
More information1 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 information22c:111 Programming Language Concepts. Fall Syntax III
22c:111 Programming Language Concepts Fall 2008 Syntax III Copyright 2007-08, The McGraw-Hill Company and Cesare Tinelli. These notes were originally developed by Allen Tucker, Robert Noonan and modified
More informationIntro to semantics; Small-step semantics Lecture 1 Tuesday, January 29, 2013
Harvard School of Engineering and Applied Sciences CS 152: Programming Languages Lecture 1 Tuesday, January 29, 2013 1 Intro to semantics What is the meaning of a program? When we write a program, we use
More informationReflective Visitor Pattern
Reflective Visitor Pattern Yun Mai and Michel de Champlain Department of Electrical and Computer Engineering Concordia University {y mai, michel@ece.concordia.ca Abstract The Visitor pattern wraps associated
More informationGetter and Setter Methods
Example 1 namespace ConsoleApplication14 public class Student public int ID; public string Name; public int Passmark = 50; class Program static void Main(string[] args) Student c1 = new Student(); Console.WriteLine("please..enter
More informationSyntax. 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 informationCS 415 Midterm Exam Spring 2002
CS 415 Midterm Exam Spring 2002 Name KEY Email Address Student ID # Pledge: This exam is closed note, closed book. Good Luck! Score Fortran Algol 60 Compilation Names, Bindings, Scope Functional Programming
More informationXAJ: An Extensible Aspect Oriented Language
XAJ: An Extensible Aspect Oriented Language Leonardo V. S. Reis, Roberto S. Bigonha, Mariza A. S. Bigonha Departamento de Ciência da Computação Universidade Federal de Minas Gerais Belo Horizonte, Brazil
More informationClasses. Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT).
UNITII Classes Logical method to organise data and functions in a same structure. Also known as abstract data type (ADT). It s a User Defined Data-type. The Data declared in a Class are called Data- Members
More informationMeta Programming with Concrete Object Syntax
Master Course Program Transformation 2004-2005 Martin Bravenboer Institute of Information & Computing Sciences Utrecht University, The Netherlands March 8, 2005 Meta-Programming with Concrete Object Syntax
More informationLL(k) Parsing. Predictive Parsers. LL(k) Parser Structure. Sample Parse Table. LL(1) Parsing Algorithm. Push RHS in Reverse Order 10/17/2012
Predictive Parsers LL(k) Parsing Can we avoid backtracking? es, if for a given input symbol and given nonterminal, we can choose the alternative appropriately. his is possible if the first terminal of
More informationNew and Noteworthy. Peter Friese Bernd Kolb
New and Noteworthy Peter Friese peter.friese@gentleware.com http://www.gentleware.com Bernd Kolb b.kolb@kolbware.de http://www.kolbware.de What is openarchitectureware? oaw Languages New: AOP Mechanisms
More informationChapter 11: Compiler II: Code Generation
Elements of Computing Systems, Nisan & Schocken, MIT Press, 2005 Chapter 11: Compiler II: Code Generation www.idc.ac.il/tecs Usage and Copyright Notice: Copyright 2005 Noam Nisan and Shimon Schocken This
More informationThe TTC 2014 FIXML Case: Rascal Solution
The TTC 2014 FIXML Case: Rascal Solution Pablo Inostroza Tijs van der Storm Centrum Wiskunde & Informatica (CWI) Amsterdam, The Netherlands pvaldera@cwi.nl Centrum Wiskunde & Informatica (CWI) Amsterdam,
More informationProperties of Regular Expressions and Finite Automata
Properties of Regular Expressions and Finite Automata Some token patterns can t be defined as regular expressions or finite automata. Consider the set of balanced brackets of the form [[[ ]]]. This set
More informationCentaur: A generic framework simplifying C++ transformation
Centaur: A generic framework simplifying C++ transformation Cedric Raud Technical Report n o 0823, July 2008 revision 1848 English: The C++ standard grammar was not thought to be easily parsable so its
More informationFormal Languages and Compilers Lecture V: Parse Trees and Ambiguous Gr
Formal Languages and Compilers Lecture V: Parse Trees and Ambiguous Grammars Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/
More informationOutline. Parser overview Context-free grammars (CFG s) Derivations Syntax-Directed Translation
Outline Introduction to Parsing (adapted from CS 164 at Berkeley) Parser overview Context-free grammars (CFG s) Derivations Syntax-Directed ranslation he Functionality of the Parser Input: sequence of
More information