monticore
play

MontiCore A Framework for DSL-Development Efficient Editor - PowerPoint PPT Presentation

MontiCore A Framework for DSL-Development Efficient Editor Generation for Compositional DSLs in Eclipse Holger Krahn, Bernhard Rumpe, Steven Vlkel Software Systems Engineering Technische Universitt Braunschweig http://www.sse-tubs.de/


  1. MontiCore A Framework for DSL-Development Efficient Editor Generation for Compositional DSLs in Eclipse Holger Krahn, Bernhard Rumpe, Steven Völkel Software Systems Engineering Technische Universität Braunschweig http://www.sse-tubs.de/

  2. Software Systems Efficient Editor Generation for Engineering TU Braunschweig Compositional DSLs in Eclipse 2 vor/03/01 1. MontiCore 2. Example: MSCs with Java 3. Editor generation 4. Live-Demo 5. Conclusion

  3. Software Systems Engineering MontiCore – Design goals TU Braunschweig 3 vor/03/01 � Compact grammar-based definition of a language in a unified format for abstract and concrete syntax • Avoids inconsistencies • Reduces effort � Generative development • Easily accessible, strongly typed, heterogeneous data structures • Generation of Java components with published interfaces and combination by configuration � Open solution • Programming of additional components � Framework-based solution • Structure of processing is predetermined for easier development of program synthesizers � Independency • Available as command line tool, Eclipse-Plugin, Online-Service

  4. Software Systems Engineering MontiCore – Creation of domain specific program TU Braunschweig synthesizers (DSLTools) 4 vor/03/01 � MontiCore can be used to create domain specific program synthesizers extended domain specific grammar format description independently created components or <<generates>> hand written source code domain specific program synthesizer language language Workflows RootFactories … processing processing DSLTool Framework * The components are organized in libraries and are created by generation or coding

  5. Software Systems Engineering MontiCore – TU Braunschweig Generation of components for language processing 5 vor/03/01 � The generated components are e.g. • Recursive-descent LL-Parser domain specific • Strongly typed AST classes with optional description associations • Simple Symboltables • Editor for Eclipse extended (Syntaxhighlighting, Outline, etc.) grammar format • Documentation (e.g., class diagram for AST, Grammar in EBNF) � Languages realized with MontiCore: • UML/P (CD, SD, OD, SC) • Finite Automata • Java 5 language processing • …

  6. Software Systems Engineering Reuse of languages TU Braunschweig 6 vor/03/01 � MontiCore supports two types of reuse of languages • Embedding • Specifying grammars with holes (grammar fragments) • Combine multiple grammars to form new language without re-compilation • Mechanism suitable to embed (possibly multiple) action languages in models • Inheritance • Inherit from an existing grammar • Add new rules or change existing ones • Extend an existing language by specifying the delta only

  7. Software Systems Efficient Editor Generation for Engineering TU Braunschweig Compositional DSLs in Eclipse 7 vor/03/01 1. MontiCore 2. Example: MSCs with Java 3. Editor generation 4. Live-Demo 5. Conclusion

  8. Software Systems Engineering Overview: Example TU Braunschweig 8 vor/03/01 � Message Sequence Charts • Conditions are expressions • Methods help to express complex conditions � Textual Concrete Syntax from ITU-TS Recommendation Z.120 Receiver Sender Message checkInbox() Response public boolean checkInbox(){ return receiver. messages > 0; }

  9. Software Systems Example: MSCs with Java Engineering TU Braunschweig Definition as MontiCore grammar 9 vor/03/01 grammar MSC options{ compilationunit MSC } MSC = "msc" name:IDENT "{" ( Instance | Method )* "}"; Instance = "instance" name:IDENT "{" Event* "}"; interface Event; SendEvent implements Event = Event = "out" message:IDENT "to" receiver:IDENT ";"; SendEvent | ReceiveEvent ReceiveEvent implements Event = | Condition "in" message:IDENT "from" sender:IDENT ";"; Condition implements Event = "condition" name:IDENT ( shared:["shared"] ( sharedWithAll:["all"] | sharedWith:IDENT ("," sharedWith:IDENT)* ) )? ( "{" Cond "}" | ";"); external Cond; "Holes" in grammar fragment external Method; // ... }

  10. Software Systems Example: MSCs with Java Engineering TU Braunschweig Abstract syntax 10 vor/03/01 grammar MSC options{ compilationunit MSC } MSC = "msc" name:IDENT "{" ( Instance | Method )* "}"; Instance = "instance" name:IDENT "{" Event* "}"; interface Event; SendEvent implements Event = MSC "out" message:IDENT "to" receiver:IDENT ";"; name: String ReceiveEvent implements Event = "in" message:IDENT "from" sender:IDENT ";"; * * Instance Condition implements Event = Method "condition" name:IDENT name: String ( shared:["shared"] ( sharedWithAll:["all"] | sharedWith:IDENT ("," sharedWith:IDENT)* ) )? ( "{" Cond "}" | ";"); external Cond; external Method; // ... }

  11. Software Systems Example: MSCs with Java Engineering TU Braunschweig Definition of associations 11 vor/03/01 associations { SendEvent.toInstance * <-> 1 Instance.messagesToBeReceived; ReceiveEvent.fromInstance * <-> 1 Instance.messagesToBeSend; Condition.targets * <-> * Instance.conditionsSharedWithMe; } targets Instance concept simplereference { name: String * ToInstance: SendEvent.receiver -> Instance.name; FromInstance: ReceiveEvent.sender -> Instance.name; <<interface>> Targets: Condition.sharedWith -> Instance.name; Event } ReceiveEvent SendEvent Condition message: String message: String name: String receiver: String receiver: String shared: bool sharedWithAll: bool * sharedWith: List<String> Cond: ASTNode conditionSharedWithMe

  12. Software Systems Engineering Embedding of Java-Grammar TU Braunschweig 12 vor/03/01 grammar MSC { grammar Java { external Cond; interface Expression = // ... // ... } } The non-terminal Action is marked as external (extension point) configure by Java-API or configuration script MSC.Cond = Java.Expression text file, e.g. grammar MSC { "condition inbox { generation external checkInbox() Cond Lexer/Parser }" } Lexer/Parser grammar Java { generation Lexer/Parser Expression = ... ; }

  13. Software Systems Efficient Editor Generation for Engineering TU Braunschweig Compositional DSLs in Eclipse 13 vor/03/01 1. MontiCore 2. Example: MSCs with Java 3. Editor generation 4. Live-Demo 5. Conclusion

  14. Software Systems Engineering Elements of editors in Eclipse TU Braunschweig 14 vor/03/01 Code and comment regions Foldings Syntaxhighlighting of keywords outline Editor action Format action

  15. Software Systems Engineering Elements of editors in Eclipse TU Braunschweig 15 vor/03/01 Problem Reports Navigator action

  16. Software Systems Engineering Where shall certain elements be defined? TU Braunschweig 16 vor/03/01 � � Fragments Syntaxhighlighting � • Java, MSC Foldable elements � Elements of outline � Language � Context menu items • MSC with Java � Error messages � Tool � Manifest.mf • Multiple cooperating � Plugin.xml languages

  17. Software Systems Where shall certain elements be defined? Engineering TU Braunschweig Fragments 17 vor/03/01 concept editorattributes { � Syntaxhighlighting � Foldable elements keywords: msc, instance, in, out, to, from, � Elements of outline action, condition, shared, all; foldable: MSC, Instance, Condition; segment: � Context menu items MSC ("pict/m.gif") show: "MSC " name; � segment: Error messages Instance ("pict/i.gif") show: name; segment: SendEvent ("pict/arrow.gif") show: "Send to " receiver ":" message; segment: ReceiveEvent ("pict/arrow.gif") � Manifest.mf show: "Receive from " sender ":" message; � Plugin.xml segment: Condition ("pict/c.gif") show: name; }

  18. Software Systems Where shall certain elements be defined? Engineering TU Braunschweig Language 18 vor/03/01 // context menu item for the editor: � Syntaxhighlighting // there will be an item "Generate code". � Foldable elements // When user selects this item, // CodegenAction will be invoked � Elements of outline menuitem Generate Trace ("mc.examples.msc.msc.action.GenerateTraceAction") ; � // popups in the package explorer: Context menu items // select 1..n *.msc-files and press � Error messages // right button. There will be an "Compose" item. // ComposeAction will be called if // the user selects it popup Compose ("mc.examples.msc.msc.compose.ComposeAction"); � Manifest.mf � Plugin.xml

  19. Software Systems Engineering Overview editor generation TU Braunschweig 19 vor/03/01 MSC MontiCore Java MSCTool Editor MSC with Java de.monticore.re de.monticore.t_re reads in generates depends on Eclipse

  20. Software Systems Efficient Editor Generation for Engineering TU Braunschweig Compositional DSLs in Eclipse 20 vor/03/01 1. MontiCore 2. Example: MSCs with Java 3. Editor generation 4. Live-Demo 5. Conclusion

More recommend