Vadim Zaytsev aka @grammarware

(Un)Parsing in a Broad Sense Parsing in a Broad Sense

Having multiple representations of the same instance is common in software language engineering: models can be visualised as graphs, edited as text, serialised as XML. When mappings between such representations are considered, many terms are used with incompatible meanings and varying sets of underlying assumptions:

This is the (mega)model of 12 classes of artefacts found in software language processing (dotted lines denote mappings that rely on either lexical or syntactic definitions; solid lines denote universally defined mappings. The loops are examples of transformations):

Bidirectional megamodel of parsing and unparsing

It can be used to systematically explore the technical research space of bidirectional mappings to build on top of the existing body of work and discover as of yet unused relationships.


BX mega, logo by Vadim Zaytsev

a string, a file, a byte stream
a finite sequence of untyped strings (called lexemes) which, when concatenated, yields STR; includes spaces, line breaks, comments, etc — collectively, layout
a finite sequence of typed tokens, possibly with layout removed, some classified as numbers, strings, etc
a hierarchical source model constructed with regular means but adding grouping to typing; in fact a possibly incomplete tree connecting most tokens together in one structure
a forest of parse trees, a parse graph or an ambiguous parse tree with sharing; a tree-like structure that models STR according to a syntactic definition, some collection of possible syntactic interpretations of STR
an unambiguous parse tree where the leaves can be concatenated to form STR
a parse tree with concrete syntax information; structurally similar to PTR, but abstracted from layout and other minor details; comments could still be a part of the CST model, depending on the use case
a tree which contains only abstract syntax information, the ultimate enriched intermediate representation for language processing
a picture, which can be an ad hoc model, a hand-drawn “natural model” or a rendering of a formal model
a model of a drawing, expressed in terms of visual primitives, their sizes, coordinates and other configurable attributes, a drawing in the sense of GraphML or SVG, or a metamodel-indepenent syntax but metametamodel-specific syntax like OMG HUTN
a graphical representation of a model (not necessarily a tree), abstracted from concrete visualisation details, mentioning at most layout grid strategies, a “boxes and arrows” model like those used in Graphviz tools
a diagram, an abstract graphical model with an explicit advanced metamodel and a known visual notation, like a UML/EMF diagram

Publications / presentations

The page is maintained by Dr. Vadim Zaytsev a.k.a. @grammarware. Last updated: February 2021.