From HaFrWiki
Jump to: navigation, search

JavaCC is a parser/scanner generator for use with Java™ applications.


Java Compiler Compile™ (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.

JavaCC works with any Java VM version 1.2 or greater. It has been certified to be 100% Pure Java. JavaCC has been tested on countless different platforms without any special porting requirements. Given that JavaCC runs on only around 5 or 6 platforms, this is a great testimonial to the "Write Once Run Anywhere" aspect of the Java programming language.


To parse a language the first thing you will need is a grammar for that language. The Grammar follows the conventions found in the Extended Backus–Naur Form (EBNF). The ISO description of the EBNF (14977) is now freely available in a ZIP-Compressed PDF.


To work with JavaCC asks for specific knowledge on parsing. The book Generating Parsers with JavaCC written by Tom Copeland.

At the website of JavaCC a lot of useful links are available. Here is a summary with a short description:

  • JavaCC FAQ, An exellent start for your survey on JavaCC. But keep in mind to read the book of Tom Copeland also.
  • JavaCC Documentation Index, Links to get you further through the docs available.

(Maybe) Useful links are:


  • Grammars, A detailed description on the structure of a language.
  • Translators, Automating migration of code or translating code.