maketea


Generate infrastructure for processing abstract syntax trees in C++

Given a grammar in an extended BNF format, maketea will generate a C++ class hierarchy to store the abstract tree for that grammar, with support for deep (recursive) cloning, deep equality, and tree pattern matching (including wildcards).

In addition it generates explicit support for the visitor design pattern in the form of a visitor API, which makes it easy to define traversals over the AST. Visitors can include 'generic' methods (for example, do such-and-such for every 'expression'), but cannot transform the tree structure.

Finally, maketea generates a transformation API which makes it easy to define tree transformations. An important property of the transformation API is that it uses the C++ type system to make it impossible to write tree transformations that violate the tree structure as dictated by the grammar.

Both the visitor and transformation APIs are set up in such a way to make their behavior completely configurable.

Project Information

Labels:
tree parser syntax compiler visitor grammar AST generator