JavaCC : Java Glossary

go to home page J words local find full screen, hide local find menu Google search web for more information on this topic jump to foot of page translate this page with Babelfish punctuation 0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z (all) ©1996-2009 2007-07-17 Roedy Green, Canadian Mind Products
JavaCC
Formerly known as Jack. JavaCC is a parser, like YACC, except that is it written in Java and generates Java code. It started out handled by Sun, then by Metamata, then bought out by Webgain, who went belly up. It is now an open source project. It is still the most popular parser written in Java. JavaCC is similar to PCCTS. JavaCC is a LL(k) (top down) parser, whereas YACC is a LALR(1) (bottom up) parser, so the grammars look quite different. The documentation is quite readable, unlike most of its competition. The parser has some parsing speedup tricks like lookahead and custom code for the tricky bits.

Check this list of tutorials. I blew my mind when a little parser I wrote worked first time. It is much simpler than it first looks. The easiest way to learn is to study the *.jj example grammar descriptions and to google for example source code for javacc code for grammars similar to what you want to tackle.

download JavaCC 4.0 free. Last revised/verified: 2007-04-20 The download zip includes documentation, Jjtree and a number of simple *.jj example grammar descriptions. Just unzip everything with embedded folder names into a Program Files directory. It does not have an explicit installer. You will want to tweak javacc-4.0\bin\javacc.bat, (the script that compiles your grammar descriptor into Java source code) and put a copy somewhere on the path.

You write little methods that describe the various phrases of your grammar. They are a mixture of Java code and JavaCC grammatical BNF. JavaCC then merges them and converts the whole thing into pure Java source code, with methods that will recognise the various phrases. When you compile that, you can parse text. In addition there are commands to describe the tokens of your language tokens — the basic units/words.

Learning More

book cover recommend book⇒Generating Parsers with JavaCC
 paperback
ISBN13:978-0-9762214-3-2impressioncounter
publisher:Centennial Books
published:2007
by:Tom Copeland
You can also order direct from the author. Also covers JJTree, JTB and JJDoc. It explains how to write Unicode parsers to handle a much richer character set than in traditional in languages. It covers integration with Eclipse, but not IntelliJ. The documentation for JavaCC is scattered over the web. This book helps you find it all. The book treats the reader gently. There is plenty of repetition, full explanation, examples, comments about what is going on under the hood, and pointing out of pitfalls. He even tells you what the various tools he is describing are useful for. You can tell he as been around the block and is talking from hard-won experience. It is like talking with a fellow programmer over coffee. He has a very kind friendly way of writing. His only fault is a tendency to belabour the obvious.
UK flag abe books.co.uk abe books.ca Canadian flag
UK flag amazon.co.uk. amazon.ca. Canadian flag
German flag abe books.de chapters.indigo.ca. Canadian flag
German flag amazon.de. abe books.com American flag
French flag abe books.fr amazon.com. American flag
French flag amazon.fr. barnes and noble.com American flag
Italian flag abe books.it powells.com American flag
Spanish flag iberlibro.com sony e-books American flag
Australian flag abe books anz

CMP homejump to top You can get the freshest copy of this page from: or possibly from your local J: drive (Java virtual drive/mindprod.com website mirror)
http://mindprod.com/jgloss/javacc.html J:\mindprod\jgloss\javacc.html
CMP logofeedback Please email your feedback for publication, errors, omissions, typos, formatting errors, ambiguities, unclear wording, broken/redirected link reports, suggestions to improve this page or comments to Roedy Green : feedback email
mindprod.com IP:[65.110.21.43]
view BlogYour face IP:[38.107.191.100]
You are visitor number 15,767.