1
0
Fork
You've already forked javacc-bootstrap
0
Code and scripts to build the javacc parser generator without the use of javacc
  • Java 97.9%
  • Shell 2.1%
David Shea 085c340549 Correct the readme regarding jjtree
I abandoned the backtracking parser idea for JJTree and just modified
JJTree.jjt into a javacc parser instead.
2026年06月30日 11:41:03 -04:00
ants Rewrite the bootstrap jjtree parser in javacc 2026年06月02日 14:03:29 -04:00
code Rewrite the bootstrap jjtree parser in javacc 2026年06月02日 14:03:29 -04:00
patches Add the ant patch I forgot to commit 2026年06月01日 08:54:35 -04:00
bootstrap.sh Rewrite the bootstrap jjtree parser in javacc 2026年06月02日 14:03:29 -04:00
LICENSE Initial commit 2026年05月02日 16:40:26 -04:00
README.md Correct the readme regarding jjtree 2026年06月30日 11:41:03 -04:00

WHAT

This project contains code for bootstrapping https://javacc.github.io/javacc/, a Java-based parser generator.

This project also bootstraps JJTree, a JavaCC preprocessor for building abstract syntax trees that is part of the JavaCC project.

WHY

JavaCC uses a grammar written in JavaCC. JavaCC handles this circular dependency by distributing a compiled version of JavaCC along with the source code.

This project provides an alternate method of building JavaCC that does not make use of any pre-compiled binaries.

HOW

The file bootstrap.sh outlines a process for buliding JavaCC from source.

The process starts with the oldest open source release of JavaCC, version 3.1. The first pass uses a new main() method to call the methods containing the mostly-static code templates, in order to extract JavaCharStream.java, ParseException.java, TokenMgrError.java, and Token.java.

The second pass uses these generated files and a list of the token names used in JavaCC.jj in order to create the token constants in JavaCCParserConstants.java.

The third pass implements the parser. This reimplements JavaCC.jj using an extremely slow backtracking parser. The third pass also generates the parser and AST classes needed by JJTree.

The fourth path regenerates the parser files using the bootstrap parser in order to create a complete build of JavaCC.

This parser is used to generate the JJTree parser class. JavaCC is used to process a hand-written JJTree.jj parser definition based on the original JJTree.jjt. This generates the JJTree parser needed for the next pass.

The fifth pass builds a full replacement bootstrap jar file.

JavaCC 3.1 can be used to build version 4.1, which in turn can be used to build the latest JavaCC.

OTHER

The source code for this project is available under the same terms as JavaCC. It's a BSD-style license, 2-clause.