An Annotation Language Framework for Statically-Typed Syntax Trees

L. Abrams and R. Toal (USA)


Parser generation, Syntax trees, Static typing.


Many of today’s parser generators, in addition to producing parsers that perform arbitrary actions during parsing, have an option to generate parsers that simply produce an ab stract syntax tree (AST). Many generators employ an AST notation tied to a specific host programming language, with unusual markup that compromises readability, and with out the expressive power to create statically typed ASTs with a rich class hierarchy of node types. This paper pro poses a notation framework for AST generation which can be adapted to nearly any grammar formalism and, while strictly declarative and of near-minimal size, can denote statically-typed ASTs that vary as widely as desired from the concrete syntax. These contributions are illustrated with the implementation of a lightweight parser generator in Java, which is shown to output extremely readable, fully statically typed AST classes with an automatically gener ated traversal mechanism.

Important Links:

Go Back