Java Tree Builder (JTB) 1.4.7

Last update : sept 25th, 2012 - version 1.4.7

Overview

JTB (Java Tree Builder) is a syntax tree builder and visitors generator to be used in front of JavaCC (Java Compiler Compiler).
It takes a JavaCC grammar file as input (usually a ".jtb" file) and automatically generates the following: New visitors, which subclass any generated one, can then override the default methods and perform various operations on and manipulate the generated syntax tree.

History

09/2012 - 1.4.7 : added sub comments in the generated visitors java code ; did some optimizations ; fixed bugs JTB-1 & JTB-2 ; fixed some generation errors ; added a check when 'n = prod()' and 'void prod()' ; added the '!' syntax for not generating a node creation (in a BNFProduction, RegExprSpec and ExpansionUnit) ; fixed some Java grammar issues and did some refactoring ; added column numbers in messages ; performed tests on more limit cases ; fixed missing in JavaCCInput() and missing parentheses in Annotation()

01/2011 - 1.4.6 : JTB hosted at http://java.net/projects/jtb ; new contributor (Francis Andre Kampbell) ; added -va and -npfx and -nsfx options

12/2010 - 1.4.5 : Convert nodes and visitors output directories to absolute paths

7/2010 - 1.4.4 : Fixed missing space after throws issue in visiting MethodDeclaration & ConstructorDeclaration of JavaPrinter; Fixed index issue in visiting TypeArguments of JavaPrinter

04/2010 - 1.4.3.2 : bug #2991455

04/2010 - 1.4.3.1 : bugs #2990962 and #2989497

03/2010 - 1.4.3 : Fixed wrong conditionals generation and TreeFormatter generation issues; added node declarations initialization

02/2010 - 1.4.2 : Fixed missing java.util package in generated JTBToolkit class, fixed accept inlining issue in visiting ExpansionChoices

02/2010 - 1.4.1 : Fixed wrong conditionals generation and missing static modifier for generated return types issues (bug 2945965), fixed hard error in semantic checker, fixed command line options overwrite issue

11/2009 - 1.4.0 : New version delivered / integrated under the JavaCC Eclipse Plug-in

xx/2005 - 1.3.2 : Last (known) version from UCLA Compilers Group : see JTB 1.3.2 home page

New Features in version 1.4.0+ / 1.4.7

Here are the following enhancements that have been added to JTB 1.3.2:

How to use

On the command line:
java -jar jtb-1.4.x.jar -h : to view all available options
java -jar jtb-1.4.x.jar [CL_Option] -si : to use system.in as the input file
java -jar jtb-1.4.x.jar [CL_Option] [input-file] : to use input-file as the input file

In the input file options section:
options {(JTB_BOOL_OPT=(true|false); | JTB_STR_OPT="str";)*}

Options are the following:

CL_OptionJTB_OptionDescription
-cl JTB_CL=(true|false)Print a list of the classes generated to standard out
-d dir JTB_D="dir" Short for (and overwrites) "-nd dir/syntaxtree -vd dir/visitor"
-dl JTB_DL=(true|false)Generate depth level info
-e JTB_E=(true|false) Suppress JTB semantic error checking
-f JTB_F=(true|false) Use descriptive node class field names
-h N/A Display this help message and quit
-ia JTB_IA=(true|false)Inline visitors accept methods on base classes
-jd JTB_JD=(true|false)Generate JavaDoc-friendly comments in the nodes and visitor
-nd dir JTB_ND="dir" Use dir as the package for the syntax tree nodes
-np pkg JTB_NP="pkg" Use pkg as the package for the syntax tree nodes
-ns classJTB_NS="class" Use class as the class which all node classes will extend
-o file JTB_o="file" Use file as the filename for the annotated output grammar
-p pkg JTB_P="pkg" Short for (and overwrites) "-np pkg.syntaxtree -vp pkg.visitor"
-pp JTB_PP=(true|false)Generate parent pointers in all node classes
-printer JTB_PRINTER Generate a syntax tree dumping visitor
-si N/A Read from standard input rather than a file
-scheme JTB_SCHEME Generate Scheme records representing the grammar and a Scheme tree building visitor
-tk JTB_TK=(true|false)Generate special tokens into the tree
-vd dir JTB_VD="dir" Use dir as the package for the default visitor classes
-vp pkg JTB_VP="pkg" Use pkg as the package for the default visitor classes
-w JTB_W=(true|false )Do not overwrite existing files

Note that the JavaCC Eclipse Plugin embeds the latest JTB version at the time is was released.

Support

Feel free to report any bug or suggest enhancement at the
JavaCC Eclipse Plug-in Sourceforge site.

License

JTB 1.3.2 is licensed under the BSD license.
JTB 1.4.x adds the GPL license and the CECILL license.