Aster: Automatic abstract syntax

View/Open

Author

Share

Metadata

Abstract

Modern parser generators typically require two components: an abstract syntax data
structure and a concrete syntax grammar specification. Usually the abstract syntax and
the concrete syntax are closely related but are specified independently because it is diffcult
to distinguish what parts of the concrete syntax are associated with the abstract syntax.
There are a few add-ons to parser generators, such as ANTLR, which allow the programmer
to specify this relationship through annotations in the concrete syntax, but their scope is
limited. In this honors thesis, I propose a new way of generating the abstract syntax data
structure. The concrete syntax grammar is used as a base for the abstract syntax data
structure. The grammar undergoes a series of transformations, where each transformation
analyzes the grammar and removes excess information, such as precedence, associativity, or
literals used only to disambiguate potential parsings. The final result is an abstract syntax
data structure. In addition, since each of these transformations can be linked together, parser
actions can be inserted into the original grammar so that an abstract syntax tree is created
when the generated parser is run.