The design and implementation of Object Grammars

An Object Grammar is a variation on traditional BNF grammars, where the notation is extended to support declarative bidirectional mappings between text and object graphs. The two directions for interpreting Object Grammars are parsing and formatting. Parsing transforms text into an object graph by recognizing syntactic features and creating the corresponding object structure. In the reverse direction, formatting recognizes object graph features and generates an appropriate textual presentation. The key to Object Grammars is the expressive power of the mapping, which decouples the syntactic structure from the graph structure. To handle graphs, Object Grammars support declarative annotations for resolving textual names that refer to arbitrary objects in the graph structure. Predicates on the semantic structure provide additional control over the mapping. Furthermore, Object Grammars are compositional so that languages may be defined in a modular fashion. We have implemented our approach to Object Grammars as one of the foundations of the Ens? system and illustrate the utility of our approach by showing how it enables definition and composition of domain-specific languages (DSLs). We introduce Object Grammars to parse textual syntax into object graphs.Cross references in the object structure are resolved using declarative paths.Complex mappings can be further controlled using predicates.We show that Object Grammars are both compositional and bidirectional.The entire system is self-describing and bootstrapped within itself.

[1]  Klaus Ostermann,et al.  Invertible syntax descriptions: unifying parsing and pretty printing , 2010, Haskell '10.

[2]  Torbjörn Ekman,et al.  The JastAdd system - modular extensible compiler construction , 2007, Sci. Comput. Program..

[3]  Frédéric Jouault Jean Bézivin On the Specification of Textual Syntaxes for Models , 2006 .

[4]  Eelco Visser,et al.  Syntax definition for language prototyping , 1997 .

[5]  Mitchell Wand,et al.  The mystery of the tower revealed: A nonreflective description of the reflective tower , 1988, LISP Symb. Comput..

[6]  Eelco Visser,et al.  The State of the Art in Language Workbenches - Conclusions from the Language Workbench Challenge , 2013, SLE.

[7]  Krzysztof Czarnecki,et al.  Feature and Meta-Models in Clafer: Mixed, Specialized, and Coupled , 2010, SLE.

[8]  Eelco Visser,et al.  Declarative Name Binding and Scope Rules , 2012, SLE.

[9]  Ivan Porres,et al.  A Relation Between Context-Free Grammars and Meta Object Facility Metamodels , 2003 .

[10]  Adrian Johnstone,et al.  GLL parse-tree generation , 2013, Sci. Comput. Program..

[11]  Steffen Becker,et al.  Classification of Concrete Textual Syntax Mapping Approaches , 2008, ECMDA-FA.

[12]  Jules J. Berman,et al.  Ruby: The Programming Language , 2008 .

[13]  Tijs van der Storm,et al.  RASCAL: A Domain Specific Language for Source Code Analysis and Manipulation , 2009, 2009 Ninth IEEE International Working Conference on Source Code Analysis and Manipulation.

[14]  Sven Apel,et al.  A calculus for uniform feature composition , 2010, TOPL.

[15]  Anthony M. Sloane,et al.  A pure embedding of attribute grammars , 2013, Sci. Comput. Program..

[16]  Jukka Paakki,et al.  Attribute grammar paradigms—a high-level methodology in language implementation , 1995, CSUR.

[17]  Masaru Tomita,et al.  LR Parsers For Natural Languages , 1984, ACL.

[18]  Laurence Tratt Direct left-recursive parsing expression grammars , 2010 .

[19]  Diego Calvanese,et al.  The Description Logic Handbook: Theory, Implementation, and Applications , 2003, Description Logic Handbook.

[20]  Daniel P. Friedman,et al.  A simple reflective interpreter , 1996, LISP Symb. Comput..

[21]  Bruno C. d. S. Oliveira,et al.  Feature-Oriented Programming with Object Algebras , 2013, ECOOP.

[22]  Russell W. Quong,et al.  ANTLR: A predicated‐LL(k) parser generator , 1995, Softw. Pract. Exp..

[23]  Andrew W. Appel,et al.  Axiomatic bootstrapping: a guide for compiler hackers , 1994, TOPL.

[24]  Eelco Visser,et al.  Language extension and composition with language workbenches , 2010, SPLASH/OOPSLA Companion.

[25]  Lukas Diekmann,et al.  Parsing composed grammars with language boxes , 2013 .

[26]  Mirko Seifert,et al.  Derivation and Refinement of Textual Syntax for Models , 2009, ECMDA-FA.

[27]  William B. Frakes,et al.  Software reuse: metrics and models , 1996, CSUR.

[28]  John McCarthy,et al.  LISP 1.5 Programmer's Manual , 1962 .

[29]  David G. Cantor,et al.  On The Ambiguity Problem of Backus Systems , 1962, JACM.

[30]  PaakkiJukka Attribute grammar paradigmsa high-level methodology in language implementation , 1995 .

[31]  Torbjörn Ekman,et al.  Modular Name Analysis for Java Using JastAdd , 2005, GTTSE.

[32]  Dennis McLeod,et al.  The semantic data model: a modelling mechanism for data base applications , 1978, SIGMOD Conference.

[33]  Brian Cantwell Smith,et al.  Reflection and semantics in LISP , 1984, POPL.

[34]  Alessandro Warth,et al.  Open, Extensible Object Models , 2008, S3.

[35]  Olivier Lecarme,et al.  Computer‐aided production of language implementation systems: A review and classification , 1982, Softw. Pract. Exp..

[36]  Douglas Crockford,et al.  The application/json Media Type for JavaScript Object Notation (JSON) , 2006, RFC.

[37]  Jean Bézivin,et al.  TCS:: a DSL for the specification of textual concrete syntaxes in model engineering , 2006, GPCE '06.

[38]  James R. Douglass,et al.  Packrat parsers can support left recursion , 2008, PEPM '08.

[39]  Niklaus Wirth,et al.  What can we do about the unnecessary diversity of notation for syntactic definitions? , 1977, Commun. ACM.

[40]  Jean Bézivin,et al.  On the unification power of models , 2005, Software & Systems Modeling.

[41]  Markus Völter,et al.  Language and IDE Modularization and Composition with MPS , 2011, GTTSE.

[42]  D. V. Schorre META II a syntax-oriented compiler writing language , 1964 .

[43]  Jean-Marc Jézéquel,et al.  Model-driven analysis and synthesis of textual concrete syntax , 2008, Software & Systems Modeling.

[44]  Eric Van Wyk,et al.  Silver: An extensible attribute grammar system , 2008, Sci. Comput. Program..

[45]  Sven Apel,et al.  FEATUREHOUSE: Language-independent, automated software composition , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[46]  Bernhard Merkle Textual modeling tools: overview and comparison of language workbenches , 2010, SPLASH/OOPSLA Companion.

[47]  Ian Piumarta Accessible Language-Based Environments of Recursive Theories ( a white paper advocating widespread unreasonable behavior ) , 2006 .

[48]  Eric Van Wyk,et al.  Verifiable composition of deterministic grammars , 2009, PLDI '09.

[49]  Krzysztof Czarnecki,et al.  Object Grammars: Compositional & Bidirectional Mapping Between Text and Graphs , 2012, SLE 2012.

[50]  Pierre-Alain Muller,et al.  Metamodel-Aware Textual Concrete Syntax Specification , 2006 .

[51]  Eelco Visser,et al.  Parse Table Composition , 2009, SLE.

[52]  Eric Van Wyk,et al.  Aspects as Modular Language Extensions , 2003, LDTA@ETAPS.

[53]  William R. Cook,et al.  Managed data: modular strategies for data abstraction , 2012, Onward! 2012.

[54]  Manuel Wimmer,et al.  Bridging Grammarware and Modelware , 2005, MoDELS Satellite Events.

[55]  Jean Bézivin,et al.  KM3: A DSL for Metamodel Specification , 2006, FMOODS.

[56]  Frédéric Fondement,et al.  Concrete syntax definition for modeling languages , 2007 .

[57]  Murray Hill,et al.  Yacc: Yet Another Compiler-Compiler , 1978 .

[58]  Bryan Ford,et al.  Parsing expression grammars: a recognition-based syntactic foundation , 2004, POPL '04.

[59]  Jean Bézivin,et al.  Model-based DSL frameworks , 2006, OOPSLA '06.

[60]  Jay Earley,et al.  A formalism for translator interactions , 1970, CACM.

[61]  Torbjörn Ekman,et al.  Modularity first: a case for mixing AOP and attribute grammars , 2008, AOSD.

[62]  Sebastian Erdweg,et al.  Language composition untangled , 2012, LDTA.

[63]  Laurian M. Chirica,et al.  The entity-relationship model: toward a unified view of data , 1975, SIGF.

[64]  Laurie J. Hendren,et al.  MetaLexer: a modular lexical specification language , 2011, AOSD '11.

[65]  Bernhard Rumpe,et al.  Integrated definition of abstract and concrete syntax for textual languages , 2007, MODELS'07.

[66]  Joost Visser Coupled Transformation of Schemas, Documents, Queries, and Constraints , 2008, Electron. Notes Theor. Comput. Sci..

[67]  Heiko Behrens,et al.  Xtext: implement your language faster than the quick and dirty way , 2010, SPLASH/OOPSLA Companion.