RSS Feed for This PostCurrent Article

Open Source Java Parser Generator

Here are 3 well-known Java parser generators that I am trying now.

ANTLR, ANother Tool for Language Recognition, is a language tool that provides a framework for constructing recognizers, interpreters, compilers, and translators from grammatical descriptions containing actions in a variety of  target languages, which include Java, C/C++, C#, Perl, Lisp, Python, etc. . It has a advanced grammar development IDE – ANTLRWorks (The ANTLR GUI Development Environment).

Java Compiler Compiler (JavaCC) is the most popular parser generator for use with Java applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc

SableCC is a parser generator which generates fully featured object-oriented frameworks for building compilers, interpreters and other text parsers. In particular, generated frameworks include intuitive strictly-typed abstract syntax trees and tree walkers. SableCC also keeps a clean separation between machine-generated code and user-written code which leads to a shorter development cycle..

CookCC is a lexer and parser generator project, combined. It is written in Java, but the target languages can vary. It uses a template approach to generate source codes, so it is quite easy to add a new target language. CookCC also comes with a suite of test cases to assist creating and testing new target languages.

A unique feature of CookCC is allowing lexer/parser to be specified using Java annotation. This feature greatly simplifies and eases the writing of lexer and parser for Java.

CookCC requires JRE 1.5+ to run, but the generated Java code can be compiled and run with earlier versions of Java.

Trackback URL

Sorry, comments for this entry are closed at this time.