© 2 0 0 6 Applied Abstractions applied-abstractions.com Textual DSLs - 1 - Textual DSLs illustrated with Eclipse Tools Sven Efftinge

Slides:



Advertisements
Similar presentations
Language Specification using Metamodelling Joachim Fischer Humboldt University Berlin LAB Workshop Geneva
Advertisements

Component Development for the Component Description Framework (CDF) Training Dr.-Ing. Ulrich Dinger.
Elevator Simulator DSL Project Presented by Miguel Garzón and Stéphane Leblanc 1.
Automated Test Design ™ © 2011 Conformiq, Inc. CONFORMIQ DESIGNER On ES v1.2.1 Stephan Schulz MBT Working Meeting/MTS#56, Göttingen.
SYSTEM PROGRAMMING & SYSTEM ADMINISTRATION
The Knowledge Industry Survival Strategy (KISS) Tony Clark, Thames Valley University, London, UK Jorn Bettin, Sofismo, Switzerland.
Train Control Language Teaching Computers Interlocking By: J. Endresen, E. Carlson, T. Moen1, K. J. Alme, Haugen, G. K. Olsen & A. Svendsen Synthesizing.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
Automated Analysis and Code Generation for Domain-Specific Models George Edwards Center for Systems and Software Engineering University of Southern California.
1/18 CS 693/793 Lecture 09 Special Topics in Domain Specific Languages CS 693/793-1C Spring 2004 Mo, We, Fr 10:10 – 11:00 CH 430.
UML CASE Tool. ABSTRACT Domain analysis enables identifying families of applications and capturing their terminology in order to assist and guide system.
Programming Languages Structure
Creating Architectural Descriptions. Outline Standardizing architectural descriptions: The IEEE has published, “Recommended Practice for Architectural.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Whole Platform Tesi di Dottorato di: RICCARDO SOLMI Università degli Studi di Bologna Facoltà di scienze matematiche, fisiche e naturali Corso di Dottorato.
Describing Syntax and Semantics
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Bridging the chasm between MDE and the world of compilation Nondini Das 1.
SEG4110 – Advanced Software Design and Reengineering
Xactium xDSLs Run Models Not Code Tony Clark
Faculty of Informatics and Information Technologies Slovak University of Technology Peter Kajsa and Ľubomír Majtás Design.
Workshop on Integrated Application of Formal Languages, Geneva J.Fischer Mappings, Use of MOF for Language Families Joachim Fischer Workshop on.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Sumant Tambe, et. al LEESA DSPD 2008 An Embedded Declarative Language for Hierarchical Object Structure Traversal Sumant Tambe* Aniruddha Gokhale Vanderbilt.
1 Extending Java And Developing DSLs With Open Source Language Workbench JetBrains MPS Konstantin Solomatov JetBrains Lead Developer for JetBrains MPS.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
Introduction to XML. XML - Connectivity is Key Need for customized page layout – e.g. filter to display only recent data Downloadable product comparisons.
Tools for Diagrammatic Specifications Stian Skjerveggen Supervisors: Yngve Lamo, Adrian Rutle, Uwe Egbert Wolter.
Building Tools by Model Transformations in Eclipse Oskars Vilitis, Audris Kalnins, Edgars Celms, Elina Kalnina, Agris Sostaks, Janis Barzdins Institute.
Models for Language Engineering Bruno F. Barroca.
Copyright © 2009 AtlanMod. All Rights Reserved Frédéric Jouault & Hugo Bruneliere AtlanMod team (INRIA & Mines de Nantes) Possible Benefits of Bridging.
Domain-Specific Development Stuart Kent, Senior Program Manager, DSL Tools, Visual Studio Team System, Microsoft.
Hyper/J and Concern Manipulation Environment. The need for AOSD tools and development environment AOSD requires a variety of tools Life cycle – support.
SaveUML System design. System overview Possible...
A Little Language for Surveys: Constructing an Internal DSL in Ruby H. Conrad Cunningham Computer and Information Science University of Mississippi.
Selected Topics in Software Engineering - Distributed Software Development.
Illustrations and Answers for TDT4252 exam, June
Evaluation of Development Tools for Domain-Specific Modeling Languages D. Amyot, H. Farah, J.-F. Roy with contributions from Y. Chu and N. Janmohamed SAM.
Hybrid Transformation Modeling Integrating a Declarative with an Imperative Model Transformation Language Pieter Van Gorp
DSL Classification October 21-22, 2007 Benoît Langlois / Thales-EPM Consuela-Elena Jitia / Eric Jouenne, Thales Research & Technology The 7th OOPSLA Workshop.
Dr. Darius Silingas | No Magic, Inc. Domain-Specific Profiles for Your UML Tool Building DSL Environments with MagicDraw UML.
FDT Foil no 1 On Methodology from Domain to System Descriptions by Rolv Bræk NTNU Workshop on Philosophy and Applicablitiy of Formal Languages Geneve 15.
Automata Based Method for Domain Specific Languages Definition Ulyana Tikhonova PhD student at St. Petersburg State Politechnical University, supervised.
ModelPedia Model Driven Engineering Graphical User Interfaces for Web 2.0 Sites Centro de Informática – CIn/UFPe ORCAS Group Eclipse GMF Fábio M. Pereira.
Visual Specification of a DSL Processor Debugger Tamás Mészáros and Tihamér Levendovszky Budapest University of Technology and Economics.
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Semantics for DSL Group Members: Ritu Arora, Diyang Chu, Zekai Demirezen, Jeff Gray, Jacob Gulotta, Luis Pedro, Arturo Sanchez, Greg Sullivan,Ximing Yu.
Weaving a Debugging Aspect into Domain-Specific Language Grammars SAC ’05 PSC Track Santa Fe, New Mexico USA March 17, 2005 Hui Wu, Jeff Gray, Marjan Mernik,
Compiler Construction (CS-636)
Domain Specific Models John D. McGregor M13S1. Tool development Eclipse is an environment intended as a basis for building software engineering tools.
LanguageLab A Meta-modelling Environment Terje Gjøsæter and Andreas Prinz, University of Agder, Norway SDL Forum 2015, Berlin, Germany.
1 Technical & Business Writing (ENG-715) Muhammad Bilal Bashir UIIT, Rawalpindi.
Modeling the ODP Computational Viewpoint with UML 2.0: The Templeman Library Example José Raúl Romero, Antonio Vallecillo Universidad de Málaga, Spain.
Parastoo Mohagheghi 1 A Multi-dimensional Framework for Characterizing Domain Specific Languages Øystein Haugen Parastoo Mohagheghi SINTEF, UiO 21 October.
October 1st 2015 Alexis Fouché 1, Florian Noyrit 1, Sébastien Gérard 1, Maged Elaasar 2 SYSTEMATIC GENERATION OF STANDARD COMPLIANT TOOL SUPPORT OF DIAGRAMMATIC.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 4 Slide 1 Software Processes.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
UML Profile BY RAEF MOUSHEIMISH. Background Model is a description of system or part of a system using well- defined language. Model is a description.
Chapter – 8 Software Tools.
FUNCTIONAL PROGRAMING AT WORK - HASKELL AND DOMAIN SPECIFIC LANGUAGES Dr. John Peterson Western State Colorado University.
Ontologies Reasoning Components Agents Simulations An Overview of Model-Driven Engineering and Architecture Jacques Robin.
1 Budapest University of Technology and Economics Department of Measurement and Information Systems Budapest University of Technology and Economics Fault.
Programming Languages Concepts Chapter 1: Programming Languages Concepts Lecture # 4.
Comparison of ZOOM with other Formal Methodologies Hsiu-Chien Jing SE690 Initial Presentation School of CTI, DePaul University Supervised by Dr. Jia October,
SysML v2 Formalism: Requirements & Benefits
Model-Driven Development -
Daniel Amyot and Jun Biao Yan
Towards an Open Meta Modeling Environment
Presentation transcript:

© Applied Abstractions applied-abstractions.com Textual DSLs Textual DSLs illustrated with Eclipse Tools Sven Efftinge Arno Haase Markus Völter

© Applied Abstractions applied-abstractions.com Textual DSLs About Applied Abstractions Markus Völter Sven Efftinge Arno Haase Bernd Kolb

© Applied Abstractions applied-abstractions.com Textual DSLs Model-Driven Development is about levels of abstraction Defining a metamodel that fits the domain as simple as possible as flexible as necessary intuitive, good match for the domain It is about defining languages “ubiquitous language“ useful for communication concrete syntax matters... although it is not the most important part different syntaxes for the same metamodel are possible

© Applied Abstractions applied-abstractions.com Textual DSLs What is a DSL (1): Domain a DSL is a language for a domain can be anything: technical, “business“,... GUI, component model, workflow description,... description of an insurance contract,... it is based on a deep understanding of the domain domain experts searching for the suitable abstractions evolving, growing the language

© Applied Abstractions applied-abstractions.com Textual DSLs What is a DSL (2): Specific A DSL is specific bounded in scope does one thing only, and does that well different trade-offs from a general-purpose language Good match for the domain's abstractions readable or even writable for domain experts small number of orthogonal concepts

© Applied Abstractions applied-abstractions.com Textual DSLs What is a DSL (3): Language a DSL is a language precise semantics: executable (interpreted, compiled, cross-compiled) expressive complete with regard to its domain

© Applied Abstractions applied-abstractions.com Textual DSLs What is a DSL (4): Characteristics Different characteristics for different domains Concrete Syntax: textual vs. graphical Domain Selection: structural vs. behavioural Expressive Power: declarative vs. imperative Execution: interpretation vs. compilation/transformation Integration: internal vs. external Tool Support: editor, debugger, …

© Applied Abstractions applied-abstractions.com Textual DSLs Why concrete syntax is important Abstract Syntax defines grammar for the language – most important for tools Concrete Syntax is the “UI” for the language – critical for DSL users concise vs. redundant intuitive simple to write and read Tool support matters IDE integration syntax highlighting metamodel awareness

© Applied Abstractions applied-abstractions.com Textual DSLs Different syntax for different abstractions / domains Different concrete syntax is well established for different domains class diagrams to describe types and structure state charts textual expression notation for behaviour XML for structured data The abstraction should drive syntax decision, not vice versa Available tool support often decides the syntax UML has its uses, but it is no panacea building specific textual languages – and IDEs to work with them – has become feasible

© Applied Abstractions applied-abstractions.com Textual DSLs UML ? UML is a pre-defined metamodel and syntax covers the rather general domain of “OO SW Development” inflexible in its notations can be extended but not restricted But what about UML 2 profiles? well-defined ways of using stereotypes and tagged values but the syntax remains pre-defined (at least in practice) UML is useful, but it is not the answer to every problem building specific graphical and textual tools has become feasible (e.g. Eclipse GMF) keep an open mind

© Applied Abstractions applied-abstractions.com Textual DSLs Tradeoffs for textual DSLs With both textual and graphical syntax you can Model for any meta model verify constraints in real time (Eclipse) write ordinary EMF models Graphical Editors are good to show structural relationships Textual Editors are better for „algorithmic“ aspects, or hierarchical models Textual Editors integrate better with CVS etc. (diff, merge)

© Applied Abstractions applied-abstractions.com Textual DSLs Parts of a textual language (1): Parser Every textual language requires a parser transform one or more text files into an object representation (aka AST) check for syntactical correctness Acts as a linker Parsers are typically generated based on a formal syntax definition (such as EBNF) antlr, javacc, LPG, …

© Applied Abstractions applied-abstractions.com Textual DSLs Parts of a textual language (2): Processor There must be code that “executes” the language Generator: generate code for a different language, typically at a lower level of abstraction Compiler: generate byte code / machine code Interpreter: walk through the object graph, executing code step by step Interpreters are especially suited for executing behavior, Generators are better at handling structural models and generating lower-level representations of these structures. Since textual DSLs are especially suited for behavioral descriptions, textual DSLs are often used together with interpreters.

© Applied Abstractions applied-abstractions.com Textual DSLs Parts of a textual language (3): IDE integration Developers have become used to good tool support syntax highlighting context sensitive assistance (here: metamodel aware code completion) overview, cross-referencing These features are not strictly part of the language, but very important for user acceptance One reason to use UML and / or XML is a prerequisite to choosing based on the best fit for a domain

© Applied Abstractions applied-abstractions.com Textual DSLs External vs. Internal DSLs External DSLs are defined separately from an existing language separate parser and execution environment separate editor / IDE a whole separate language No symbolic integration Internal DSLs are defined within an existing language leveraging extension mechanism of the language – C macros, Ruby metaprogramming, Lisp macros,... good symbolic integration with the language Internal DSLs are also usually limited syntactically constrained to what the host language offers Typically not very good specific IDE support

© Applied Abstractions applied-abstractions.com Textual DSLs External DSLs: Implementation The AST is the core It is either directly interpreted Or transformed into GPL code (which is then interpreted or further transformed, i.e. compiled) AST can be created by Direct editing (typically via a graphical editor) Or via a parser from a typically textual representation Examples: oAW, GMF, xText, etc. („classic“ MDSD)

© Applied Abstractions applied-abstractions.com Textual DSLs Internal DSLs: Interpreted I: Metaprogramming Source code contains the metaprogram (M) defining the DSL as well as a program in the DSL (D) After parsing, the AST contains the metaprogram and the program (this is possible, since D is syntactically compatible with the host language) In the interpreter, the DSL program D uses the metaprogram M and produces the desired effect Examples: Lisp, Ruby

© Applied Abstractions applied-abstractions.com Textual DSLs Internal DSLs: Interpreted I: Metaprogramming II The (often separate) metaprogram M modifies the interpreter effectively producing a custom interpreter that knows about M and can interpret DSL programs D The modified interpreter interprets the DSL program D as part of the host program Example: CLOS

© Applied Abstractions applied-abstractions.com Textual DSLs Internal DSLs: Compiled I The program contains host code and DSL code D. A parser that knows about D builds an AST with a part that is specific to M (AST D ). Inside the compiler, a special transformer (M-specific) transforms AST D into a regular AST which then compiled with the compiler code of the host language. In homogenous systems, the language for implementing Parser M and Transformer M are the same as the host language (program and metaprograms can be mixed, too). Example: Converge

© Applied Abstractions applied-abstractions.com Textual DSLs Internal DSLs: Compiled II The metaprogram modifies the Compiler to understand D programs (aka open compilers, Compile-Time MOP) The Compiler M now understands D – depending on how far the modification goes, D can have specific syntax or not In homogenous systems, the language for implementing M are the same as the host language (program and metaprograms can be mixed, too). Example: OpenC++

© Applied Abstractions applied-abstractions.com Textual DSLs Strengths of Textual DSLs Textual languages have specific strengths compared to graphical languages ideally there should be the option to have both compact and expressive syntax productivity for experienced users IDE support softens learning curve configuration management/versioning and integration into the “regular” development process splitting a model into several files concurrent work on a model, especially with a version control system: diff, merge search, replace

© Applied Abstractions applied-abstractions.com Textual DSLs Tooling for Textual DSLs oAW’s xText Open Source (at Eclipse GMT) Simple, starting with the concrete syntax definition Allows for custom constraint integration INRIA’s TCS (Textual Concrete Syntax) Open Source (at Eclipse GMT) Starts with the domain metamodel Support for operators and serialization Eclipse Modeling TMF is in preparation… IBM’s SAFARI (T.J. Watson) Not open source (yet) Very powerful framework for building Eclipse IDEs for custom languages – keep an eye on it!

© Applied Abstractions applied-abstractions.com Textual DSLs oAW xText (1) oAW’s textual DSL generator framework xText simplifies defining a textual syntax for a domain-specific language Based on a BNF-like syntax definition language it generates: An EMF-based metamodel (representing the AST) An Antlr parser instantiating dynamic EMF-models An Eclipse text editor plugin providing syntax highlighting customizable outline view, Syntax folding syntax checking as well as constraints checking based on a Check file, as always oAW

© Applied Abstractions applied-abstractions.com Textual DSLs xText (2) The grammar (shown in the boostrapped editor) The first rule describes the root element of the AST The generated eCore AST model States contain a number of entry actions, transitions and exit actions Assigns an indentifier to a variable (here: state) These variables will become attributes of the AST class Rule name Rule names will become the AST classes

© Applied Abstractions applied-abstractions.com Textual DSLs xText (3) You can define additioal constraints that should be validated in the generated editor. This is based on oAW’s Check language i.e. These are constraints like all the others you’ve already come across

© Applied Abstractions applied-abstractions.com Textual DSLs xText (4) Literals have become keywords The generated editor and it’s outline view Constraint s are evaluated in real time

© Applied Abstractions applied-abstractions.com Textual DSLs xText (5)

© Applied Abstractions applied-abstractions.com Textual DSLs THE END. Thanks! Please ask questions!

© Applied Abstractions applied-abstractions.com Textual DSLs Some Advertisement. Völter, Stahl: Modellgetriebene Softwareentwicklung Technik, Engineering, Management dPunkt, An updated translation is available: Model-Driven Software Development, Wiley, Auflage in Arbeit! Mit Arno Haase und Sven Efftinge als neue Co-Autoren!