DSL Implementation. ... with language Workbenches. v1.1 Jan 16, Markus Voelter independent/itemis

Size: px
Start display at page:

Download "DSL Implementation. ... with language Workbenches. v1.1 Jan 16, Markus Voelter independent/itemis"

Transcription

1 DSL Implementation... with language Workbenches. v1.1 Jan 16, 2013 Markus Voelter independent/itemis +Markus Voelter

2

3 Last Year s Talk This Year s Talk Design No Tools The why Implementation 3 Tools The how

4 Last Year s Talk This Year s Talk Design No Tools The why Implementation 3 Tools The how Both taken from my new book: available Feb 2013

5

6 Intro- duction

7 Language Workbench (Mar1n Fowler)

8 Language Workbench (Mar1n Fowler) Freely define languages and integrate them

9 Language Workbench (Mar1n Fowler)? use persistent abstract representa1on

10 Language Workbench (Mar1n Fowler) language ::= + schema + editors generators

11 Language Workbench (Mar1n Fowler)? projec1onal edi1ng

12 Language Workbench (Mar1n Fowler) persist incomplete or contradictory informa1on

13 Language Workbench (Mar1n Fowler) + powerful edi1ng tes1ng refactoring debugging groupware language defini1on implies IDE defini1on

14 Language Workbench (Mar1n Fowler) support for classical programming and + classical modeling

15

16 more in GPLs more in DSL Domain Size large and complex smaller and well-defined Designed by guru or committee a few engineers and domain experts Language Size large small Turing-completeness almost always often not User Community In-language abstraction large, anonymous and widespread sophisticated small, accessible and local limited Lifespan years to decades months to years (driven by context) Evolution Incompatible Changes slow, often standardized almost impossible fast-paced feasible

17 General Purpose C Components State Machines Domain Specific Sensor Access LEGO Robot Control

18

19 Model or Code?

20 Model or Code? next [alt > 0] beforeflight reset crashed next [alt == 0 && speed == 0] airborne flying next [alt == 0 && speed > 0] landing next [alt == 0 && speed == 0] landed

21 Model or Code?

22 Model or Code?

23 Model or Code? Does it really matter? What is the difference? Who cares?

24

25 We don t want to model, we want to program!

26 We don t want to model, we want to program! at different levels of abstraction from different viewpoints integrated!

27 We don t want to model, we want to program! with different degrees of domain-specificity with suitable notations with suitable expressiveness

28 We don t want to model, we want to program! and always: precise and tool processable

29

30 Big Language o a b n c m k L d e j f i h g with many first class concepts!

31 Small Language α δ L β ω λ with a few, orthogonal and poweful concepts

32 Modular Language α my L d e f g h i j k l β with many optional, composable modules

33

34 Example Tools

35 Example Tools Parser-based LL(k)

36 Example Tools Projectional MPS

37 Example Tools Parser-based GLR Spoofax

38

39 Syntax

40 Concrete and Abstract

41 Parsing Parsing

42 Parsing vs. Projection Parsing Projection

43

44 Parsing BNF, EBNF Grammars

45 Parsing Grammar Classes LL }Limitations LL(k) wrt. all LL(*) Context Free LR Grammars

46 Parsing Grammar Class Limitations Left Recursion! Not supported by LL Parsers

47 Parsing Grammar Class Limitations Left Recursion! Not supported by LL Parsers -> Left Factoring

48 Parsing Grammar Class Limitations Alternative: GLR or Earley parsers -> parses all CFGs -> O(n), O(n 3 ) worst case -> LL(1)

49 Parsing Ambiguities & Grammar Classes

50 Parsing Ambiguities & Grammar Classes -> LR Problem: Precedence encoded in grammar structure! -> LL

51 Parsing Spoofax Ambiguities & GLR Parsers Better: Declarative, Extensible

52

53 Projection MPS Very Flexible Syntax

54 Projection MPS Very Flexible Syntax

55 Projection MPS Very Flexible Syntax Challenges: Editor Usabililty, Infrastructure Integration

56 Projection MPS Editor Usability Traditionally a challenge. Mostly solved in MPS.

57 Projection MPS Editor Usability Traditionally a challenge. Mostly solved in MPS. Aliases Side Transformations Smart References Smart Delimiters Delete Actions Wrappers Create Ref Target

58 Projection MPS Infrastructure Integration

59

60 AST Formalisms The Essence Things with properties child Things references to other Things extending other Things

61 AST Formalisms Xtext Ecore

62 AST Formalisms MPS MPS Structure

63 AST Formalisms Spoofax Spoofax Aterms

64

65 Scoping

66 Typical Approach Today s Approach (Xtext or MPS) Scope = Function that returns the possible target elements for a referenece

67 Typical Approach Today s Approach (Xtext or MPS) Scope = Function that returns the possible target elements for a referenece Implemented as procedural code.

68 Typical Approach Today s Approach (Xtext or MPS) Scope = Function that returns the possible target elements for a referenece Implemented as procedural code. Associated with context directly, via naming convention or procedurally.

69 Typical Approach Xtext Today s Approach (Xtext or MPS) Xtext

70 Typical Approach MPS Today s Approach (Xtext or MPS) MPS

71

72 New Idea Using DSLs for defining DSLs Use dedicated DSLs to define aspects of DSLs

73 New Idea Using DSLs for defining DSLs Use dedicated DSLs to define aspects of DSLs Old idea for grammar/syntax.

74 New Idea Using DSLs for defining DSLs Use dedicated DSLs to define aspects of DSLs Old idea for grammar/syntax. Now increasingly used for other aspects such as scoping (we ll see type system, debugging later)

75 Spoofax NBL Spoofax Defining Namespaces Define Namespaces: Qualified Names

76 Spoofax NBL Spoofax Defining Namespaces Name Qualification implies Uniqueness Limitations on Visibility

77 Spoofax NBL Spoofax Defining References

78 Spoofax NBL Spoofax Defining References Not clear which Entity!

79 Spoofax NBL Spoofax Defining References Integration with type system required.

80

81 Constraints

82 Standard Constraints Xtext Boolean Expressions Xtext CheckType.NORMAL CheckType.FAST CheckType.EXPENSIVE

83 Standard Constraints MPS Boolean Expressions MPS Evaluated only on demand via ReadListeners

84 Standard Constraints Spoofax Boolean Expressions Spoofax Based on Pattern Matching -> very concise

85

86 Dataflow Analysis The problem Is code unreachable? Is a variable read before it is written? Can a value be null when it is read? Can we know statically that a variable always has a constant value (and hence can be optimized)? -> Dataflow Analysis

87 Dataflow Analysis MPS The Dataflow Graph

88 Dataflow Analysis MPS The Dataflow Graph

89 Dataflow Analysis MPS The Dataflow Graph

90 Dataflow Analysis MPS for the IfStatement

91 Dataflow Analysis MPS for the IfStatement

92 Dataflow Analysis MPS for the IfStatement

93 Dataflow Analysis MPS The actual Anylses predefined you can also build your own ones

94

95 Type System

96 Type Systems? Assign fixed types

97 Type Systems? Derive Types Assign fixed types

98 Type Systems? Derive Types Assign fixed types Calculate Common Types

99 Type Systems? Assign fixed types Derive Types Calculate Common Types Check Type Consistency

100

101 Classic Approach Xtext based on Functions/Recursion Example Code:

102 Classic Approach Xtext based on Functions/Recursion Example Code: Type System Implementation:

103 Classic Approach Xtext based on Functions/Recursion Better Type System Implementation:

104

105 Declarative Type Sys. MPS Unification/Solver (MPS) Example Code: Type System Implementation:

106 Declarative Type Sys. MPS Unification/Solver (MPS) Example Code: Type System Implementation: Example Scenario 1

107 Declarative Type Sys. MPS Unification/Solver (MPS) Example Code: Type System Implementation: Example Scenario 2

108 Declarative Type Sys. MPS Unification/Solver (MPS) Example Code: Type System Implementation: Example Scenario 3

109 Declarative Type Sys. MPS Unification/Solver (MPS) Example Code: Type System Implementation: Example Scenario 4

110 Declarative Type Sys. MPS Automatic Type Inference Example Code:

111 Declarative Type Sys. MPS Automatic Type Inference Example Code: Type System Implementation: That is all!

112

113 Declarative Type Sys. Spoofax Pattern Matching

114 Declarative Type Sys. Spoofax Pattern Matching

115 Declarative Type Sys. Spoofax Pattern Matching

116 Declarative Type Sys. Spoofax Pattern Matching

117

118 Transfor- mation & Generation

119 Text Template Engine Xtext Xtext s Xtend (M2T, M2M) Not just a template language like StringTemplate or Xpand. Actually a very nice and fullblown GPL with special support for text templating and model navigation, query and construction.

120 Text Template Engine Xtext Xtext s Xtend (M2T, M2M) Java Like Many improvemnts over Java Modularization via DI Template Expressions Smart Whitespace Handling Functional Abstractions Dispatch on Arguments Extension Methods Builders

121 Text Template Engine Xtext Xtext s Xtend

122 Text Template Engine Xtext Dispatch Methods

123 Text Template Engine Xtext Builder Syntax (1)

124 Text Template Engine Xtext Builder Syntax (2)

125 Model Inferrence Xtext Xtext, Xbase and Java Instead of generating Java source, M2M to Java AST (for structurally relevant parts)

126 Model Inferrence Xtext Xtext, Xbase and Java Instead of generating Java source, M2M to Java AST (for structurally relevant parts) You get code gen implicitly.

127 Model Inferrence Xtext Xtext, Xbase and Java Instead of generating Java source, M2M to Java AST (for structurally relevant parts) You get code gen implicitly, but also: scoping type system debugger

128 Model Inferrence Xtext Xtext, Xbase and Java

129 Model Inferrence Xtext Xtext, Xbase and Java

130 Model Inferrence Xtext Xtext, Xbase and Java

131 Model Inferrence Xtext Xtext, Xbase and Java

132 Model Inferrence Xtext Xtext, Xbase and Java Java text for the body/ implementation. (no IDE support here)

133

134 Multi-Stage Trafo MPS MPS Transformations

135 Multi-Stage Trafo MPS MPS Transformations

136 Transformations MPS with concrete Syntax & IDE IDE support for target language Macros contain template code M2M with M2T feel

137 Transformations MPS with concrete Syntax & IDE

138 Transformations MPS with concrete Syntax & IDE

139 Transformations MPS with concrete Syntax & IDE

140 Transformations MPS Builders are supported as well Language Extension: No builder functions necessary IDE support But is specific for Models

141

142 Pattern Matching Spoofax For text generation

143 Pattern Matching Spoofax For transformation

144 Pattern Matching Spoofax M2M with concrete Syntax

145 Pattern Matching Spoofax M2M with concrete Syntax Needs escaped composition grammar!

146

147 Inter- pretation

148 Interpreters Xtext Xtend is very useful! Java Like General Purpose Language Many improvemnts over Java Functional Abstractions Dispatch on Arguments Extension Methods Builders Template Expressions Smart Whitespace Handling Trafo Modularization via DI

149 Interpreters MPS MPS interpreter extension makes writing dispatchers much simpler modular extension!

150 Live IDEs MPS Embedding Interpreters real-time feedback in the IDE!

151

152 IDE Services

153 Syntax Highlighting MPS Declarative Approach

154 Syntax Highlighting MPS Declarative Approach

155 Syntax Highlighting Spoofax Declarative Approach

156 Find References MPS Custom Finders

157 Find References MPS Custom Finders

158 Formatting Spoofax Declarative Box Language

159 Visualization Xtext Jan Koehnlein s GraphView

160

161 Testing

162 Parser/Syntax Testing Spoofax Declarative Approach abstract syntax concrete syntax

163 Constraints/Type Sys. MPS Declarative Approach Test annotations on the test subject very concise.

164 Testing Semantics MPS Expressing tests in language Generate/Interpret the tests along with the application code

165 Testing Editors Xtext Using Moritz Eysholdt s Xpect Test expectations in comments. Can test various language aspects such as scopes, code completion, type system; also extensible.

166

167 Inspecting/ Debugging

168 Inspecting Programs MPS Parsing doesn t happen!

169 Debugging DSLs MPS Behavior

170 Debugging DSLs MPS Type System Declarative Type Systems use Equations and a Solver. Equations + Solver State can be visualized (not always intuitive)

171 Debugging DSLs Xtext Transformations & Code Gens

172 Debugging DSLs MPS Transformations Multi-Level, Declarative: show intermediate models and the templates involved in trafo.

173 Debugging DSL Programs Xtext Xbase Automatic Debugging Make your DSL extend Xbase Use a JVMModelInferrer -> Java you then get Debugging for free Mostly. Sometimes you have to manually establish traces.

174 Debugging DSL Programs MPS Extensible Debuggers

175 Debugging DSL Programs MPS Extensible Debuggers Language Extension Generated C Code

176 Debugging DSL Programs MPS Extensible Debuggers Stepping

177 Debugging DSL Programs MPS Extensible Debuggers Watches

178 Debugging DSL Programs MPS Debugger Architecture

179

180 Modularization, Extension and Composition

181 Language Extension MPS C extensibility in mbeddr Plain C

182 Language Extension MPS C extensibility in mbeddr C + Units Plain C

183 Language Extension MPS C extensibility in mbeddr C + State Machines

184 Language Extension MPS C extensibility in mbeddr C + State Machines and Units! -> combination of independent extensions!

185 Language Extension Xtext Embedding Xbase into DSL Entities using Java types and Xtend code in the body of operations.

186 Language Extension Xtext Embedding Xbase into DSL

187 Language Extension Xtext Embedding Xbase into DSL See before results in generator, scoping, typing, etc. with little additional work.

188 Language Extension Xtext Extending Xbase with Dates Grammar Repeat complete Xliteral rule, adding the XDateLiteral

189 Language Extension Xtext Extending Xbase with Dates Type system

190 Language Extension Xtext Extending Xbase with Dates Interpreter Compiler

191

192 Embedding MPS Useful for Meta Data No Dependencies on anything.

193

194 Meta

195 Extending the Tool MPS since it is bootstrapped!

196 Extending the Tool MPS since it is bootstrapped! Extending MPS is (almost) like extending any other language!

197 Extending the Tool Xtext using Platform APIs Jnario custom folding editor.

198

199 The Web

200 Web-based DSL Editing Challenges (Re-)Implementing LWB in the Browser Browser-Based Parsing Tier-Splitting Multi-User (real-time?) A Research Agenda:

201 Web-based DSL Editing Xtext Xtext Prototype Based on Orion An Eclipse-Instance On server per client Developed in a research project

202 Web-based DSL Editing MPS* JetBrains/MPS Generic Projectional Editor being developed; driven by Youtrack Workflows Java-Scipt based (completely in Browser) Will be made compatible with MPS language definitions

203

204 Other Tools

205 Intentional

206 Intentional

207 SugarJ (Uni Marburg)

208 Language Workbenches Language Workbench Comp {etition arison} Dozens of LWBs compared based on the same example languages

209

210 The End. voelter.de +Markus Voelter

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

10 Thoughts 2 Demos * Discussions

10 Thoughts 2 Demos * Discussions Developing Embedded software with Language Workbenches Stuttgart, 20.09.2011 Markus Voelter Independent/itemis voelter@acm.org 10 Thoughts 2 Demos * Discussions 1 1 Embedded Development Two Classes in

More information

A little History Domain Specific Languages Examples Tools Benefits A more theoretical View Programming and Modeling The LWES Project Bonus: Best

A little History Domain Specific Languages Examples Tools Benefits A more theoretical View Programming and Modeling The LWES Project Bonus: Best Domain Specific Languages Markus Voelter Independent/itemis voelter@acm.org A little History Domain Specific Languages Examples Tools Benefits A more theoretical View Programming and Modeling The LWES

More information

Programming Modeling Two Worlds? Programmierung Modellierung Zwei Welten? und. and. Markus Voelter Independent/itemis

Programming Modeling Two Worlds? Programmierung Modellierung Zwei Welten? und. and. Markus Voelter Independent/itemis und Programmierung Modellierung Zwei Welten? and Modeling Two Worlds? Markus Voelter Independent/itemis voelter@acm.org Markus Voelter Independent/itemis voelter@acm.org 1 Languages C# Erlang C++ Python

More information

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language

Plan. Language engineering and Domain Specific Languages. Language designer defines syntax. How to define language Plan Language engineering and Domain Specific Languages Perdita Stevens School of Informatics University of Edinburgh 1. Defining languages 2. General purpose languages vs domain specific languages 3.

More information

Domain-Specific Languages Language Workbenches

Domain-Specific Languages Language Workbenches Software Engineering with and Domain-Specific Languages Language Workbenches Peter Friese Itemis peter.friese@itemis.de Markus Voelter Independent/itemis voelter@acm.org 1 Programming Languages C# Erlang

More information

Language engineering and Domain Specific Languages

Language engineering and Domain Specific Languages Language engineering and Domain Specific Languages Perdita Stevens School of Informatics University of Edinburgh Plan 1. Defining languages 2. General purpose languages vs domain specific languages 3.

More information

Variability differences among products in PL. Variability in PLE. Language Workbenches. Language Workbenches. Product Line Engineering

Variability differences among products in PL. Variability in PLE. Language Workbenches. Language Workbenches. Product Line Engineering PPL 2009 Keynote Markus Voelter Indepenent/itemis voelter@acm.org http://www.voelter.de Language Workbenches in Product Line Engineering Variability in PLE Language Workbenches in Domain Specific Languages

More information

Language Workbenches, Embedded Software and Formal Verification

Language Workbenches, Embedded Software and Formal Verification Language Workbenches, Embedded Software and Formal Verification Markus Voelter independent/itemis voelter@acm.org www.voelter.de voelterblog.blogspot.de @markusvoelter +Markus Voelter Daniel Ratiu ForTISS

More information

Testing DSLs How to test DSLs, their IDEs and Programs

Testing DSLs How to test DSLs, their IDEs and Programs Testing DSLs How to test DSLs, their IDEs and Programs Markus Voelter independent/itemis voelter@acm.org www.voelter.de voelterblog.blogspot.de @markusvoelter +Markus Voelter A DSL is a focussed, processable

More information

DESIGN, EVOLUTION AND USE

DESIGN, EVOLUTION AND USE DESIGN, EVOLUTION AND USE of KernelF voelter@acm.org www.voelter.de @markusvoelter Markus Völter Check out the paper! http://voelter.de/data /pub/kernelf-icmt.pdf EXAMPLE 1 Healthcare 1 Context Mobile

More information

Domain Specific Languages. Product Line Engineering

Domain Specific Languages. Product Line Engineering Using Domain Specific Languages in the context of Product Line Engineering Markus Voelter Independent/itemis voelter@acm.org Using Domain Specific Languages in the context of Product Line Engineering DSLs

More information

A conceptual framework for building good DSLs. Markus Voelter independent/itemis

A conceptual framework for building good DSLs. Markus Voelter independent/itemis DSL Design A conceptual framework for building good DSLs Markus Voelter independent/itemis voelter@acm.org www.voelter.de voelterblog.blogspot.de @markusvoelter +Markus Voelter based on material from a

More information

Programming Languages

Programming Languages Trends in Programming Languages ICALEPCS 2011 Markus Voelter Independent/itemis voelter@acm.org A single language to rule them all An ecosystem of languages An ecosystem of languages The Pendulum Swings

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

Domain Specific Languages. Requirements (Engineering)

Domain Specific Languages. Requirements (Engineering) Domain Specific Languages and Requirements (Engineering) Andreas Graf Andreas.graf@itemis.de Markus Voelter www.voelter.de voelter@acm.org What are Requirements? a requirement is a singular documented

More information

An Evaluation of Domain-Specific Language Technologies for Code Generation

An 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 information

openarchitectureware 4.1 An introduction

openarchitectureware 4.1 An introduction openarchitectureware 4.1 An introduction Markus Voelter, www.voelter.de, openarchitectureware (oaw) is a suite of tools and components assisting with model driven software development, more precisely it

More information

Model-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 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 information

ABAP DSL Workbench SAP TechED 2016

ABAP DSL Workbench SAP TechED 2016 ABAP DSL Workbench SAP TechED 2016 Barcelona, November 2016-0 - Hello. Hello. Example Asia Diner Yes? Number 77. Take away? No. Hello. Hello. Hello. Hello. As always? Yes. As always? Yes. Where are the

More information

Automated Testing of DSL Implementations

Automated Testing of DSL Implementations Software Quality Journal manuscript No. (will be inserted by the editor) Automated Testing of DSL Implementations Experiences from Building mbeddr Daniel Ratiu Markus Voelter Domenik Pavletic Received:

More information

Domain Specific - a Binary Decision?

Domain 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 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

PEG-Based Language Workbench

PEG-Based Language Workbench PEG-Based Language Workbench Yuriy Korenkov, Ivan Loginov, Arthur Lazdin Saint Petersburg National Research University of Information Technologies, Mechanics and Optics Saint Petersburg, Russia ged.yuko,

More information

What Every Xtext User Wished to Know Industry Experience of Implementing 80+ DSLs

What Every Xtext User Wished to Know Industry Experience of Implementing 80+ DSLs What Every Xtext User Wished to Know Industry Experience of Implementing 80+ DSLs EclipseCon Europe 2016 2016-10-26 Roman Mitin Avaloq Evolution AG Allmendstrasse 140 8027 Zurich Switzerland T +41 58 316

More information

What are Requirements?

What are Requirements? Domain Specific Languages and Requirements (Engineering) Markus Voelter www.voelter.de voelter@acm.org What are Requirements? 1 a requirement is a singular documented need of what a particular product

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

Frustrated by all the hype?

Frustrated by all the hype? Fundamentals of Software Architecture Looking beyond the hype Markus Völter (voelter@acm.org) Introduction Frustrated by all the hype? If so this presentation is for you. Otherwise you should leave People

More information

with openarchitectureware

with openarchitectureware Model-Driven Development with openarchitectureware Markus Völter voelter@acm.orgorg www.voelter.de Sven Efftinge sven@efftinge.de www.efftinge.de Bernd Kolb bernd@kolbware.de www.kolbware.de 2006-7 Völter,

More information

Markus Völter

Markus Völter of Markus Völter voelter@acm.org www.voelter.de @markusvoelter Examples 1 Healthcare Context & Motivation Mobile Apps that help patients w/ treatments Monitor side-effects and recommend actions Manage

More information

Automatized Generating of GUIs for Domain-Specific Languages

Automatized Generating of GUIs for Domain-Specific Languages Automatized Generating of GUIs for Domain-Specific Languages Michaela Bačíková, Dominik Lakatoš, and Milan Nosáľ Technical University of Košice, Letná 9, 04200 Košice, Slovakia, (michaela.bacikova, dominik.lakatos,

More information

Dániel Darvas Domain-specific languages (DSLs): what, how and when?

Dániel Darvas Domain-specific languages (DSLs): what, how and when? Dániel Darvas Domain-specific languages (DSLs): what, how and when? ICE Tea 21/02/2014 Outline Theory Concept of DSLs Technology Support for DSLs Reality Some details of the ST Example DSL Theory / Concept

More information

Introduction to OpenArchitectureWare

Introduction to OpenArchitectureWare Introduction to OpenArchitectureWare Dr. Neil Loughran Neil.Loughran@sintef.no 20 th April 2009 ICT 1 Objective To give some insights into an alternative model transformation approach i.e. OpenArchitectureWare

More information

Extending Java TM TM And Developing DSLs With JetBrains MPS Open- Source Language Workbench

Extending Java TM TM And Developing DSLs With JetBrains MPS Open- Source Language Workbench Extending Java TM TM And Developing DSLs With JetBrains MPS Open- Source Language Workbench Konstantin Solomatov JetBrains Lead Developer for JetBrains MPS Project 1 Agenda > Extending languages. Why bother?

More information

Let s build. like they build. Markus Völter Bernd Kolb

Let s build. like they build. Markus Völter Bernd Kolb Let s build like they build Markus Völter voelter@acm.org www.voelter.de @markusvoelter Bernd Kolb kolb@itemis.de www.itemis.de @berndkolb B 0 Motivation Examples 1 M Healthcare Context & Motivation Mobile

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

Introduction to Dependable Systems: Meta-modeling and modeldriven

Introduction to Dependable Systems: Meta-modeling and modeldriven Introduction to Dependable Systems: Meta-modeling and modeldriven development http://d3s.mff.cuni.cz CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics 3 Software development Automated software

More information

New and Noteworthy. Peter Friese Bernd Kolb

New 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 information

Language Shapes (Architectural) Thought Markus Völter

Language Shapes (Architectural) Thought Markus Völter Language Shapes (Architectural) Thought Markus Völter voelter@acm.org www.voelter.de @markusvoelter Language Shapes (Architectural) Thought Sapir Whorf hypothesis aka Whorfianism The principle of linguis;c

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

In Our Last Exciting Episode

In Our Last Exciting Episode In Our Last Exciting Episode #1 Lessons From Model Checking To find bugs, we need specifications What are some good specifications? To convert a program into a model, we need predicates/invariants and

More information

Declarative. Contracts

Declarative. Contracts Declarative Smart Contracts Markus Völter voelter@acm.org www.voelter.de @markusvoelter 1 Context SMART An actual contract, executed automatically. CONTRACT Any Turing Complete Program running on a Blockchain.

More information

CSSE 490 Model-Based Software Engineering: Domain Specific Language Introduction

CSSE 490 Model-Based Software Engineering: Domain Specific Language Introduction CSSE 490 Model-Based Software Engineering: Domain Specific Language Introduction Shawn Bohner Office: Moench Room F212 Phone: (812) 877-8685 Email: bohner@rose-hulman.edu Plan for the Day Introduction

More information

Practical DSL Design. Groovy Sydney Meetup May 4th, Peter Bell CEO/CTO SystemsForge

Practical DSL Design. Groovy Sydney Meetup May 4th, Peter Bell CEO/CTO SystemsForge Practical DSL Design Groovy Sydney Meetup May 4th, 2010 Peter Bell CEO/CTO SystemsForge Overview Before DSLs... What is a DSL? Creating a DSL Good DSL Design Key Concepts Implementing DSLs in Groovy Testing

More information

CSE 12 Abstract Syntax Trees

CSE 12 Abstract Syntax Trees CSE 12 Abstract Syntax Trees Compilers and Interpreters Parse Trees and Abstract Syntax Trees (AST's) Creating and Evaluating AST's The Table ADT and Symbol Tables 16 Using Algorithms and Data Structures

More information

Domain-Specific Languages for Composable Editor Plugins

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 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

Domain-Specific. Languages. Martin Fowler. AAddison-Wesley. Sydney Tokyo. With Rebecca Parsons

Domain-Specific. Languages. Martin Fowler. AAddison-Wesley. Sydney Tokyo. With Rebecca Parsons Domain-Specific Languages Martin Fowler With Rebecca Parsons AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Paris Madrid Sydney Tokyo Singapore

More information

Introduction to Model Driven Engineering using Eclipse. Frameworks

Introduction to Model Driven Engineering using Eclipse. Frameworks Introduction to Model Driven Engineering using Eclipse Model Driven Development Generator s Bruce Trask Angel Roman MDE Systems Abstraction Model Driven Development Refinement 1 Part I Agenda What is Model

More information

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

Parsing II Top-down parsing. Comp 412

Parsing II Top-down parsing. Comp 412 COMP 412 FALL 2018 Parsing II Top-down parsing Comp 412 source code IR Front End Optimizer Back End IR target code Copyright 2018, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled

More information

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Winter /15/ Hal Perkins & UW CSE C-1

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Winter /15/ Hal Perkins & UW CSE C-1 CSE P 501 Compilers Parsing & Context-Free Grammars Hal Perkins Winter 2008 1/15/2008 2002-08 Hal Perkins & UW CSE C-1 Agenda for Today Parsing overview Context free grammars Ambiguous grammars Reading:

More information

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Spring UW CSE P 501 Spring 2018 C-1

CSE P 501 Compilers. Parsing & Context-Free Grammars Hal Perkins Spring UW CSE P 501 Spring 2018 C-1 CSE P 501 Compilers Parsing & Context-Free Grammars Hal Perkins Spring 2018 UW CSE P 501 Spring 2018 C-1 Administrivia Project partner signup: please find a partner and fill out the signup form by noon

More information

Semantic Modularization Techniques in Practice: A TAPL case study

Semantic Modularization Techniques in Practice: A TAPL case study 1 Semantic Modularization Techniques in Practice: A TAPL case study Bruno C. d. S. Oliveira Joint work with Weixin Zhang, Haoyuan Zhang and Huang Li July 17, 2017 Text 2 EVF: An Extensible and Expressive

More information

Combined Object-Lambda Architectures

Combined Object-Lambda Architectures www.jquigley.com jquigley#jquigley.com Chicago Lisp April 2008 Research Goals System Goals Conventional Systems Unconventional Systems Research Goals Question: How to make with Pepsi and Coke? The Goal:

More information

ECLIPSE MODELING PROJECT

ECLIPSE MODELING PROJECT ECLIPSE MODELING PROJECT A Domain-Specific Language Toolkit Richard С. Gronback AAddison-Wesley Upper Saddle River, NJ Boston Indianapolis San Francisco New York Toronto Montreal London Munich Pans Madrid

More information

Building Compilers with Phoenix

Building 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 information

Projecting a Modular Future

Projecting a Modular Future Projecting a Modular Future Markus Voelter 1, Jos Warmer 2, and Bernd Kolb 3 1 independent/itemis, voelter@acm.org 2 independent, jos.warmer@openmodeling.nl 3 itemis, bernd.kolb@itemis.de Abstract. We

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

CS 406/534 Compiler Construction Putting It All Together

CS 406/534 Compiler Construction Putting It All Together CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy

More information

CSCI312 Principles of Programming Languages!

CSCI312 Principles of Programming Languages! CSCI312 Principles of Programming Languages!! Chapter 3 Regular Expression and Lexer Xu Liu Recap! Copyright 2006 The McGraw-Hill Companies, Inc. Clite: Lexical Syntax! Input: a stream of characters from

More information

Generic Language Technology

Generic Language Technology Generic Language Technology Working with Xtext Introduction We have used Xtext to define a concrete syntax for a domain-specific language called Simple Language of Communicating Objects (SLCO). This language

More information

Comparing graphical DSL editors

Comparing graphical DSL editors Comparing graphical DSL editors AToM 3 vs GMF & MetaEdit+ Nick Baetens Outline Introduction MetaEdit+ Specifications Workflow GMF Specifications Workflow Comparison 2 Introduction Commercial Written in

More information

Derivations vs Parses. Example. Parse Tree. Ambiguity. Different Parse Trees. Context Free Grammars 9/18/2012

Derivations vs Parses. Example. Parse Tree. Ambiguity. Different Parse Trees. Context Free Grammars 9/18/2012 Derivations vs Parses Grammar is used to derive string or construct parser Context ree Grammars A derivation is a sequence of applications of rules Starting from the start symbol S......... (sentence)

More information

CSE 401/M501 Compilers

CSE 401/M501 Compilers CSE 401/M501 Compilers ASTs, Modularity, and the Visitor Pattern Hal Perkins Autumn 2018 UW CSE 401/M501 Autumn 2018 H-1 Agenda Today: AST operations: modularity and encapsulation Visitor pattern: basic

More information

Model transformations. Model transformations. Model transformations. Model transformations

Model transformations. Model transformations. Model transformations. Model transformations The initialization of the attributes of a generated target model element by assigning references: Model target element generated by current rule Default target model element generated by another rule Non-default

More information

Syntax Analysis. The Big Picture. The Big Picture. COMP 524: Programming Languages Srinivas Krishnan January 25, 2011

Syntax Analysis. The Big Picture. The Big Picture. COMP 524: Programming Languages Srinivas Krishnan January 25, 2011 Syntax Analysis COMP 524: Programming Languages Srinivas Krishnan January 25, 2011 Based in part on slides and notes by Bjoern Brandenburg, S. Olivier and A. Block. 1 The Big Picture Character Stream Token

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

CS5363 Final Review. cs5363 1

CS5363 Final Review. cs5363 1 CS5363 Final Review cs5363 1 Programming language implementation Programming languages Tools for describing data and algorithms Instructing machines what to do Communicate between computers and programmers

More information

Applying Model Driven Technologies in the Creation. of Domain Specific Modeling Languages

Applying Model Driven Technologies in the Creation. of Domain Specific Modeling Languages Applying Model Driven Technologies in the Creation Model Driven Development Language Editor Generator Abstraction Model Driven Development Refinement of Domain Specific Modeling Languages Bruce Trask Angel

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

BIG MODELS AN ALTERNATIVE APPROACH

BIG MODELS AN ALTERNATIVE APPROACH 2. BIG MODELS AN ALTERNATIVE APPROACH Whitepaper Eclipse Summit 2008 Modeling Symposium Jos Warmer, Ordina (jos.warmer@ordina.nl) Abstract Scaling up modeling within project runs into many practical problems.

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

EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing. Görel Hedin Revised:

EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing. Görel Hedin Revised: EDAN65: Compilers, Lecture 04 Grammar transformations: Eliminating ambiguities, adapting to LL parsing Görel Hedin Revised: 2017-09-04 This lecture Regular expressions Context-free grammar Attribute grammar

More information

ECE251 Midterm practice questions, Fall 2010

ECE251 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 information

Declaratively Defining Domain-Specific Language Debuggers

Declaratively 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 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

Formats of Translated Programs

Formats of Translated Programs Formats of Translated Programs Compilers differ in the format of the target code they generate. Target formats may be categorized as assembly language, relocatable binary, or memory-image. Assembly Language

More information

Semantic Analysis Attribute Grammars

Semantic Analysis Attribute Grammars Semantic Analysis Attribute Grammars Martin Sulzmann Martin Sulzmann Semantic Analysis Attribute Grammars 1 / 18 Syntax versus Semantics Syntax Analysis When is a program syntactically valid? Formalism:

More information

EDAN65: Compilers, Lecture 06 A LR parsing. Görel Hedin Revised:

EDAN65: Compilers, Lecture 06 A LR parsing. Görel Hedin Revised: EDAN65: Compilers, Lecture 06 A LR parsing Görel Hedin Revised: 2017-09-11 This lecture Regular expressions Context-free grammar Attribute grammar Lexical analyzer (scanner) Syntactic analyzer (parser)

More information

Transition from EBNF to Xtext

Transition from EBNF to Xtext Transition from EBNF to Xtext Jianan Yue State Key Laboratory for Novel Software Technology, Nanjing University Department of Computer Science & Technology, Nanjing University 210023 Nanjing, China b111220168@smail.nju.edu.cn

More information

arxiv: v1 [cs.pl] 21 Jan 2013

arxiv: 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 information

An IDE for the Grammatical Framework John J. Camilleri University of Gothenburg

An IDE for the Grammatical Framework John J. Camilleri University of Gothenburg Chapter 1 An IDE for the Grammatical Framework John J. Camilleri University of Gothenburg Abstract The GF Eclipse Plugin provides an integrated development environment (IDE) for developing grammars in

More information

Stop coding Pascal. Saturday, April 6, 13

Stop coding Pascal. Saturday, April 6, 13 Stop coding Pascal...emotional sketch about past, present and future of programming languages, Python, compilers, developers, Life, Universe and Everything Alexey Kachayev CTO at KitApps Inc. Open source

More information

Parsing. Roadmap. > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing

Parsing. Roadmap. > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing Roadmap > Context-free grammars > Derivations and precedence > Top-down parsing > Left-recursion > Look-ahead > Table-driven parsing The role of the parser > performs context-free syntax analysis > guides

More information

CSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Autumn /20/ Hal Perkins & UW CSE H-1

CSE P 501 Compilers. Implementing ASTs (in Java) Hal Perkins Autumn /20/ Hal Perkins & UW CSE H-1 CSE P 501 Compilers Implementing ASTs (in Java) Hal Perkins Autumn 2009 10/20/2009 2002-09 Hal Perkins & UW CSE H-1 Agenda Representing ASTs as Java objects Parser actions Operations on ASTs Modularity

More information

What do Compilers Produce?

What do Compilers Produce? What do Compilers Produce? Pure Machine Code Compilers may generate code for a particular machine, not assuming any operating system or library routines. This is pure code because it includes nothing beyond

More information

Introduction. Compiler Design CSE Overview. 2 Syntax-Directed Translation. 3 Phases of Translation

Introduction. Compiler Design CSE Overview. 2 Syntax-Directed Translation. 3 Phases of Translation Introduction Compiler Design CSE 504 1 Overview 2 Syntax-Directed Translation 3 Phases of Translation Last modifled: Mon Jan 25 2016 at 00:15:02 EST Version: 1.5 23:45:54 2013/01/28 Compiled at 12:59 on

More information

Lecture 14: Parser Conflicts, Using Ambiguity, Error Recovery. Last modified: Mon Feb 23 10:05: CS164: Lecture #14 1

Lecture 14: Parser Conflicts, Using Ambiguity, Error Recovery. Last modified: Mon Feb 23 10:05: CS164: Lecture #14 1 Lecture 14: Parser Conflicts, Using Ambiguity, Error Recovery Last modified: Mon Feb 23 10:05:56 2015 CS164: Lecture #14 1 Shift/Reduce Conflicts If a DFA state contains both [X: α aβ, b] and [Y: γ, a],

More information

Final Examination May 5, 2005

Final Examination May 5, 2005 CS 4352 Compilers and Interpreters Final Examination May 5, 2005 Name Closed Book. If you need more space ask for an extra sheet. 1. [4 points] Pick the appropriate data structure for each purpose: storage

More information

Comp 411 Principles of Programming Languages Lecture 3 Parsing. Corky Cartwright January 11, 2019

Comp 411 Principles of Programming Languages Lecture 3 Parsing. Corky Cartwright January 11, 2019 Comp 411 Principles of Programming Languages Lecture 3 Parsing Corky Cartwright January 11, 2019 Top Down Parsing What is a context-free grammar (CFG)? A recursive definition of a set of strings; it is

More information

Chapter 4. Abstract Syntax

Chapter 4. Abstract Syntax Chapter 4 Abstract Syntax Outline compiler must do more than recognize whether a sentence belongs to the language of a grammar it must do something useful with that sentence. The semantic actions of a

More information

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1

Java Program Structure and Eclipse. Overview. Eclipse Projects and Project Structure. COMP 210: Object-Oriented Programming Lecture Notes 1 COMP 210: Object-Oriented Programming Lecture Notes 1 Java Program Structure and Eclipse Robert Utterback In these notes we talk about the basic structure of Java-based OOP programs and how to setup and

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

Writing a Simple DSL Compiler with Delphi. Primož Gabrijelčič / primoz.gabrijelcic.org

Writing a Simple DSL Compiler with Delphi. Primož Gabrijelčič / primoz.gabrijelcic.org Writing a Simple DSL Compiler with Delphi Primož Gabrijelčič / primoz.gabrijelcic.org About me Primož Gabrijelčič http://primoz.gabrijelcic.org programmer, MVP, writer, blogger, consultant, speaker Blog

More information

xtc Robert Grimm Making C Safely Extensible New York University

xtc Robert Grimm Making C Safely Extensible New York University xtc Making C Safely Extensible Robert Grimm New York University The Problem Complexity of modern systems is staggering Increasingly, a seamless, global computing environment System builders continue to

More information

Chapter 3 (part 3) Describing Syntax and Semantics

Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 (part 3) Describing Syntax and Semantics Chapter 3 Topics Introduction The General Problem of Describing Syntax Formal Methods of Describing Syntax Attribute Grammars Describing the Meanings

More information

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking

CSE450. Translation of Programming Languages. Lecture 11: Semantic Analysis: Types & Type Checking CSE450 Translation of Programming Languages Lecture 11: Semantic Analysis: Types & Type Checking Structure Project 1 - of a Project 2 - Compiler Today! Project 3 - Source Language Lexical Analyzer Syntax

More information

Syntax Analysis. COMP 524: Programming Language Concepts Björn B. Brandenburg. The University of North Carolina at Chapel Hill

Syntax Analysis. COMP 524: Programming Language Concepts Björn B. Brandenburg. The University of North Carolina at Chapel Hill Syntax Analysis Björn B. Brandenburg The University of North Carolina at Chapel Hill Based on slides and notes by S. Olivier, A. Block, N. Fisher, F. Hernandez-Campos, and D. Stotts. The Big Picture Character

More information

Syntax Analysis/Parsing. Context-free grammars (CFG s) Context-free grammars vs. Regular Expressions. BNF description of PL/0 syntax

Syntax Analysis/Parsing. Context-free grammars (CFG s) Context-free grammars vs. Regular Expressions. BNF description of PL/0 syntax Susan Eggers 1 CSE 401 Syntax Analysis/Parsing Context-free grammars (CFG s) Purpose: determine if tokens have the right form for the language (right syntactic structure) stream of tokens abstract syntax

More information