JAVA TREEBUILDER
Overview
JTB is a syntax tree builder to be used with the Java
Compiler Compiler (JavaCC) parser generator. It takes a plain
JavaCC grammar file as input and automatically generates the following:
-
A set of syntax tree classes based on the productions in the grammar, utilizing
the Visitor design pattern.
-
Two interfaces: Visitor and GJVisitor. Two
depth-first visitors: DepthFirstVisitor and GJDepthFirst,
whose default methods simply visit the children of the current node.
-
A JavaCC grammar jtb.out.jj with the proper annotations to build the syntax tree during
parsing.
New visitors, which subclass DepthFirstVisitor or GJDepthFirst,
can then override the default methods and perform various operations on
and manipulate the generated syntax tree. For more information about
the Visitor design pattern, see the book Design
Patterns: Elements of Reusable Object-Oriented Software.
Usage: java -jar jtb.jar [OPTIONS] [input-file]
java -jar jtb.jar -h # to view all available options
Download
The current version of JTB is 1.3.2. It requires Java 1.5 or higher.
You can download it here: jtb132.jar
You can download the source code for jtb 1.3.2 here: jtb132.src.jar
Tools
The Tools are under the same license as JTB JTB License
- LineNumberInfo:
This is a tool that lets you easily look at the line and column number info. for a node in the JTB syntax tree so you can print errors with line number informantion. (Javadoc, Source Class file).
Documentation
The documentation for JTB 1.3.2 is not available yet. You can look at the documentation for previous versions here: OLD JTB
License
JTB is licensed under the BSD license. You can get a copy of the license here: JTB License
Copyright © 2004, 2005, UCLA Compilers Group