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).
objects, languages, grammars, modeling, bidirectional transformation
Processors (acm D.3.4), Formal Definitions and Theory (acm D.3.1)
Software (theme 1)
North-Holland
dx.doi.org/10.1016/j.scico.2014.02.023
Science of Computer Programming
Domain Specific Languages: A Big Future for Small Programs
Software Analysis and Transformation

van der Storm, T, Cook, W.R, & Loh, A. (2014). The design and implementation of Object Grammars. Science of Computer Programming, 96(4), 460–487. doi:10.1016/j.scico.2014.02.023