Object Grammars: Compositional & Bidirectional Mapping Between Text and Graphs

Tijs van der Storm, William R. Cook, Alex Loh. Object Grammars: Compositional & Bidirectional Mapping Between Text and Graphs. 2012.

Abstract

Object Grammars define a mapping between text and object graphs. Parsing recognizes syntactic features and creates the corresponding object structure. In the reverse direction, rendering recognizes graph structures and generates an appropriate textual presentation. The key to Object Grammars is the expressive power of the mapping: how different can the syntactic and graph structures be? We define a new approach to compositional Object Grammars where the semantic structures can be arbitrary graphs of objects. To handle graphs, the system supports declarative resolution/rendering of textual names that denote references, or cross links, in the object structure. Predicates on the abstract model can be used to provide additional control over the mapping. The system also supports compositions of Object Grammars, allowing modular definition of languages. We have implemented our approach to Object Grammars in the Ensō system and illustrate the utility of our approach by showing how it enables definition and composition of domain-specific languages (DSLs).