|Here you will find some examples and links to
programs built using JTB 1.0 or JTB 1.1. To download .jar files,
please click right-button on the file name and choose "Save Link As".
JTB Base Examples
These are examples provided by the author of JTB, Kevin Tao. Contact
current JTB developer Wanjun Wang at email@example.com
for questions, comments, etc.
JJTree/JTB comparison. JJTree 0.3pre3 (packaged with
JavaCC 0.7pre5) and JTB 1.0 were both used on a very simple grammar subset
of Scheme to perform the task of finding and reporting undeclared variables.
Download this example and examine the differences between programming for
JJTree and JTB. Also see the Other Tools
page for a discussion on the differences between these two tools. This
example has been updated for use with JTB 1.0, JavaCC 0.7, and JJTree 0.3pre5.
Pretty printer updated for JTB 1.1. This example has been
rewritten using the updated grammar in JavaCC 0.7.1 and the JTB 1.1pre4
TreeFormatter template (see the Documentation
for details). Several bugs have been fixed and the example is now
distributed in jar format. See the Sun's Java documentation
for information on using the jar utility.
Pretty printer for the Java 1.1 grammar. This is the original
pretty printer example for JTB 1.0. This example uses
the Java1.1.jj grammar file included with JavaCC 0.6.1 in its original
form. It takes as input a Java file and outputs a nicely indented
version. In this version, comments are not preserved. It is
an example of how simple and organized the visitor pattern makes this task.
Java Tree Builder. As a slightly more complex example of using
JTB, the current version of JTB itself was bootstrapped using a previous
version of itself. Download the package
and see the source code.
These examples were created by users of JTB.
OQL parser by Xin Zhang (firstname.lastname@example.org).
This parser follows the complete standard of ODMG 2.0 for OODBMS.
Xin's work can be found at http://davis.wpi.edu/dsrg/OOSE/OQL.
JTB Token Modification by Bruno Daniel (email@example.com).
A problem with JTB 1.0 is that there is no way to access JavaCC special
tokens in the tree. This is a modification to the JTB source code
that addresses this problem by building JavaCC Tokens into the
tree rather than JTB NodeTokens.
Pretty Printer Extension by Bruno Daniel (firstname.lastname@example.org).
This is a very interesting extension to the above JTB pretty printer.
It automatically wraps lines that are wider than 80 characters. It
also copies comments from the input file, which my pretty printer example
for JTB 1.0 does not.