A Language Oriented Programming Language

A Language Oriented Programming Language

Cedalion: A Language Oriented Programming Language Boaz Rosenan Dept. of Computer Science The Open University of Israel Joint Work With: David H. Lorenz LOP: Middle-Out Development DSL Code DSL Code Concise (Application(Application Implementation) Implementation) DSLDSL Definition Definition Expressive DSLDSL Implementation Implementation Reusable LOP: Middle-Out Development DSL Code DSL Code Concise (Application(Application Implementation) Implementation) DSL1 DSL2 DSL3DSLDSL Definition DefinitionDSL4 DSL5 DSL6 Expressive DSLDSL Implementation Implementation Reusable LOP Platforms Freedom in defining Easy to implement syntax and semantics ✶Haskel ✶Intentional ✶Lisp ✶ModelTalk ✶MPS ✶Ruby Internal ? External DSLs DSLs (Language Workbench) Language Design Perspective ✶Haskel ✶Intentional ✶Lisp ✶ModelTalk ✶MPS ✶Ruby Internal DSLs Language Design Perspective Static Analysis ✶Cedalion ✶Haskel ✶Intentional ✶Lisp ✶ModelTalk ✶MPS ✶Ruby Internal Projectional DSLs Editing Projectional Editing Traditional Text File ParsingParsing AST Projectional Editing View ProjectionProjection Model EditingEditing A Peek at Cedalion DSL Definition DSL Implementation DSL Code (Application Implementation) Outline Introduction LOP Example Designing an LOP Language Demo Conclusion Example: LOP with Internal DSLs Task: Implement a parser for a given BNF grammar S ::= aSb S ::= aSb S ::= S ::= Steps: 1.Translating the specification into a “parsable” form in our target language, while implicitly defining the DSL. 2.Making the code executable by implementing the DSL constructs. We use Prolog as a host language. Step 1: Formalizing the Spec We use Prolog's (meta) syntax to express the grammar (our specifications). We define our DSL as we go. Terminal Production Rule s::=[a],s::=[a], s,s, [b].[b]. s::=[].s::=[]. Concatenation Empty String ⇒ S ::= aSb S ::= aSb S ::= S ::= Step 2: Making It Executable Syntactic definition of '::=' :- op(1100, xfx, '::='). parse([], X, X). Empty String parse([T], [T|L], L). Terminal parse((P1,P2), X, Y) :- parse(P1, X, X1), Concatenation parse(P2, X1, Y). parse(P, X, Y) :- (P ::= Q), Production Rule parse(Q, X, Y). parse(P, T, R): succeeds if a prefix of T is derivable from P, leaving residue R. Limitations of Internal DSLs in Prolog Syntactic Limitations When fusing several DSLs, operator collisions may occur. Semantic Limitations No conformance checking. Mistakenly writing s::={a},s,{b} instead of s::=[a],s,[b] will result in a bug, not an error. What is Cedalion Static Analysis Cedalion is an LOP Programming Language Internal Projectional DSLs Editing The Best of All Worlds MPS Static Analysis Intentional ModelTalk Haskell Internal Projectional DSLs Editing Lisp Cedalion Our Approach Static Language Analysis Workbenches Cedalion Internal Projectional DSLs Editing Designing an LOP Language Extensible Extensible C/C++ Static C# Analysis Haskell Java Lisp Nemerle Prolog Internal Projectional DSLs Editing Ruby Smalltalk Designing an LOP Language Extensible Extensible C/C++ Static C# HomoiconicHomoiconic Analysis Haskell Java Lisp Nemerle Prolog Internal Projectional DSLs Editing Ruby Smalltalk Designing an LOP Language Extensible Extensible C/C++ Static C# HomoiconicHomoiconic Analysis Haskell Dynamic Dynamic Java Lisp Nemerle Prolog Internal Projectional DSLs Editing Ruby Smalltalk Designing an LOP Language Extensible Extensible C/C++ Static C# HomoiconicHomoiconic Analysis Haskell Dynamic Dynamic Java Lisp ValidatorsValidators Nemerle Prolog Internal Projectional DSLs Editing Ruby Smalltalk Cedalion An LOP language Extensible, homoiconic, and dynamic Statically typed, using Hindley-Milner type inference, implemented using validators. Uses projectional editing (cannot be edited as text) Based on logic programming As its “Domain 0” Comes with a Language Workbench Provides pojectional editing for Cedalion The Cedalion Workbench Based on Eclipse (3.5). Queries the Cedalion program for information on how to project language constructs. Outline Introduction LOP Example Designing an LOP Language Demo Conclusion Related Work Meta Programming System A language workbench for external DSLs. Developed by S. Dmitriev at Jetbrains, released 2009. Intentional Domain Workbench A language workbench for external DSLs. Developed by C. Simonyi at Intentional Software, not released yet. ModelTalk/Ink A language workbench for XML-based internal DSLs. Used internally at Pontis. [A. Hen-Tov, D. H. Lorenz and L. Shachter, 2009]. Conclusion Cedalion is a proof of concept Provides the ease of defining internal DSLs. Provides full control in defining syntax and semantics. Future Work Making Cedalion ready for “prime time”. Case studies: Solve real-life problems with Cedalion. Evaluating other base semantics. Thank You Cedalion http://aop.cslab.openu.ac.il/research/cedalion/ Boaz Rosenan [email protected] http://wiki-openu.openu.ac.il/research/index.php/Boaz_Rosenan David H. Lorenz [email protected] http://www.openu.ac.il/home/lorenz/ .

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    26 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us