JJTree
JJTree is a preprocessor used with the Java Compiler Compiler (JavaCC) to facilitate the construction of Abstract Syntax Trees (ASTs) during parsing. It provides a separate tree grammar language that lets developers specify the desired AST structure independently from the underlying lexical and parsing rules. When JJTree processes a tree grammar, it translates it into a standard JavaCC grammar file and injects code to build the AST according to the defined tree layout.
Historically, JJTree originated as part of the JavaCC project, developed by Terence Parr in the 1990s. It
In practice, a developer writes a tree grammar that describes how tokens and productions should appear in
The generated AST typically relies on a base node class, such as SimpleNode, with concrete node types