http://javacc.dev.java.net/ 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: 1. First define the grammar for the language you want to parse. This is done in a BackusNaurForm-like manner following a defined syntax and placed in a '''jj''' file. You have to know some about how the compiler compiler works to do this correctly. 2. Then generate the parser classes from your '''jj''' file. You will get a number of source files that have all the functionality to perform the parse. 3. Connect the generated code with whatever controlling class you like. 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. -- FredrikRubensson ---- '''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 ---- CategorySoftwareTool