CookCC is a lexer/parser (LALR (1)) generator project under BSD license.
The unique feature of CookCC is that one can directly specify lexer patterns and parser grammars within the Java code using Java annotations. The result is a much easier and more straightforward way of designing lexer/parsers.
Traditionally, writing lexer / parser using code generators requires using proprietary file format. As the result, one could not use advanced Java IDE features such as syntax highlighting, error checking, code template and context sensitive helps etc. Using XML only made it possible to deal with different languages, but it does not simplify the task of writing the code. The result is that the code written in these formats are difficult to write, difficult maintain and difficult to document.
The Java Annotation approach makes it possible to utilize the best / modern Java IDEs features. At the same time, it allows refactoring, reference finding etc. Additionally, the java annotation is not required for runtime. The generated code can be run under earlier versions of JVM (prior 1.5).
Significant efforts have been made to generate fast and efficient codes that are optimized for all conditions. The result is a fast start up and fast running time. CookCC is about twice as fast as JFlex in fast word count example.
Other features include providing detail lexer pattern, and parser grammar warnings / analysis. Ant task has been provided.
Bug reports, Comments and Suggestions are welcome.
Lexer only codes:
http://code.google.com/p/cookcc/source/browse/trunk/javaap_src/org/yuanheng/cookcc/input/javaap/FileHeaderScanner.java (cycally generated and used in CookCC)
Lexer & Parser codes: