The JavaCompilerCompiler or JavaCC as it is usually called is a parser generator developed in Java by a team originally at Sun.
It is an LL parser and, as such, detects parse errors earlier than LR parsers. This can be especially handy for interpreters, but takes some getting used to if you're accustomed to LR parsers such as yacc.
It works something like this:
There is also a preprocessor (JJTree) available that preprocess a grammar and inserts code for generating a parse tree. It can be told to generate code that supports the Visitor pattern and the result is a very powerful way to inspect and mutate the tree.
Similar projects
AntlrTranslatorGenerator does something similar. It can also generate C++.
Gobo (http://www.gobosoft.com) does something similar. It generates Eiffel.
A good book on object oriented java parsers (imperative, logic, database etc) is "Building Parsers With Java" uses UML and comes with CD with all the code. http://www.amazon.com/exec/obidos/tg/detail/-/0201719622/102-2231723-1852105?v=glance