- 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. |
||
|---|---|---|
| ants | Rewrite the bootstrap jjtree parser in javacc | |
| code | Rewrite the bootstrap jjtree parser in javacc | |
| patches | Add the ant patch I forgot to commit | |
| bootstrap.sh | Rewrite the bootstrap jjtree parser in javacc | |
| LICENSE | Initial commit | |
| README.md | Correct the readme regarding jjtree | |
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.