• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Model-Driven Software Development - Language Workbenches & Syntax Definition
 

Model-Driven Software Development - Language Workbenches & Syntax Definition

on

  • 3,571 views

Language Workbenches & Syntax Definition

Language Workbenches & Syntax Definition

Statistics

Views

Total Views
3,571
Views on SlideShare
2,688
Embed Views
883

Actions

Likes
0
Downloads
66
Comments
0

3 Embeds 883

https://blackboard.tudelft.nl 818
http://blackboard.tudelft.nl 59
http://www.slideshare.net 6

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Model-Driven Software Development - Language Workbenches & Syntax Definition Model-Driven Software Development - Language Workbenches & Syntax Definition Presentation Transcript

    • Language Workbenches & Syntax Definition Lecture 6 Course IN4308 Eelco Visser Master Computer Science http://eelcovisser.org Delft University of Technology
    • Part II Modeling Languages
    • Language Workbenches Lecture 6
    • Language Modeling Lectures 6-7
    • Transformation, Generation, Analysis Lectures 8-10
    • Customization Model generate customize Code Lecture 10
    • Advanced Topics Economics ★ costs and benefits of developing (with) DSLs Evolution ★ maintenance of models and languages Portability ★ supporting multiple platforms Internal DSLs ★ library as a language Language composition ★ combining multiple DSLs Lectures 12-14
    • Language Workbenches
    • parse check Model AST Errors desugar Traditional Compiler core Architecture generate Code
    • Compiler Ingredients Syntax definition ★ concrete syntax ★ abstract syntax Static semantics ★ error checking ★ name resolution ★ type analysis Model-to-model transformation ★ express constructs in core language Code generation ★ translate core language models to implementation
    • Integrated Development Environments extended requirements for language definition
    • Editor Services for Modern IDEs Syntactic Editor Services ★ syntax checking ★ bracket matching ★ syntax highlighting ★ code folding ★ outline view Semantic Editor Services ★ error checking ★ reference resolving ★ hover help ★ code completion ★ refactoring
    • Demonstration: NWL in Spoofax
    • parse Editor AST feedback core Integrated Development Environment Code
    • Architectural Requirements for IDEs Editor services are based on AST ★ services analyze structure, not text of source Error recovery ★ continue services in presence of syntactic errors Incremental processing ★ effort of applying analysis, transformation, generation should be proportional to change in source Separate compilation (analysis, transformation) ★ keep track of dependencies
    • Holy Grail of Software Language Definition Automatically derive efficient, scalable, incremental compiler + usable IDE from high-level, declarative language definition
    • Language Definition Tools Parser generators ★ automatically generate parsers from grammars ★ LEX/YAC, Bison, ANTLR, ... Meta-programming tools ★ DSLs for programming with programs as data ★ TXL, ASF+SDF, Stratego, JastAdd, RascalMPL, ... IDE generators/frameworks ★ tools for construction of IDE plugins ★ IMP, TMF ★ Synthesizer Generator, Centaur, Lrc
    • Language Workbenches Integrated development environment for ★ language definition ★ application of language Textual languages ★ ASF+SDF MetaEnvironment, XText, MontiCore, EMFText, Spoofax Structure editors ★ MPS Visual languages ★ MetaEdit+, DSL Tools, ...
    • Spoofax/IMP
    • The Spoofax/IMP Language Workbench Syntax definition: SDF ★ declarative, modular syntax definition Transformation, analysis, generation: Stratego ★ rewrite rules, strategies, dynamic rules Editor services ★ domain-specific languages for configuration Based on IMP framework by IBM Research
    • Syntax Definition
    • Syntax Definition Pretty-Print Parse Table Signature Table Parse Transform Pretty-Print @Entity entity User { class User { name :: String String _user; pw :: Secret public User } getUser() { def output(u : syntax definition is basis of language definition return _user; User) { }
    • Lexical & Context-Free Syntax
    • Structure of Sentences composed from
    • Context-Free Grammar sort regular expression symbol Definition grammar production Property* {Stat “;”}* “entity”
    • Lexical Syntax regular expression character class characters in lexical syntax not separated by layout
    • Syntax of Data Models
    • Recognizing Well-Formed Sentences
    • Lexical Syntax: Identifiers & Literals follow restriction: symbol may not reserved words be followed by character from this class: BlogEntry is one ID
    • Lexical Syntax: Strings escape complement escape escape
    • Lexical Syntax: Whitespace LAYOUT? is inserted between symbols in CF productions normalize
    • Lexical Syntax: Comment
    • Modular Syntax Definition
    • Meta-Grammar
    • Parsing & Abstract Syntax building structured representation of sentence
    • Constructor Annotations
    • Terms to Represent Abstract Syntax Entity(“Blog”, [Property(“name”,SimpleType(“String”)), Property(“author”, SimpleType(“User”))] )
    • Parsing
    • Parsing
    • Parsing
    • Parsing
    • Parsing
    • Parsing in Spoofax
    • Signatures defining the structure of abstract syntax terms
    • Syntax Definition Pretty-Print Parse Table Signature Table Parse Transform Pretty-Print @Entity entity User { class User { name :: String String _user; pw :: Secret public User } getUser() { def output(u : syntax definition is basis of language definition return _user; User) { }
    • Signatures declare arguments and types of constructors signature is generated from grammar
    • Disambiguation
    • Arithmetic Expressions note: this style produces good abstract syntax Plus(Times(Var(“x”),Int(2)),Var(“z”))
    • Associativity
    • Priority
    • Parsing after Disambiguation
    • Brackets
    • Syntax Definition Pretty-Print Parse Table Signature Table Parse Transform Pretty-Print @Entity entity User { class User { name :: String String _user; pw :: Secret public User } getUser() { def output(u : syntax definition is basis of language definition return _user; User) { }
    • Schedule Lab this week ★ Design 1: deadline is April 1 ★ Design 2: what DSL will you design? Cases ★ Case 2: web abstractions ★ Deadline Case 2: April 8 Next ★ Lecture 7: editor services & basic code generation