This entry in the Archive of Interesting Code contains an LR(0) parser generator, which accepts as input an LR(0) grammar and returns a parser that can construct a parse tree for a string contained in the grammar.
This code is much more complex than some of the other entires in the Archive, mainly because of the complexity of managing grammars, terminals, nonterminals, etc. As a result, I have prepared a Javadoc overview of the code contained here, which should make it easier to reason about the code here.
The most interesting code here is contained in the LR0ParserGenerator.java file, which has the actual logic required to construct the parser. The remaining code is mostly infrastructural.
Enjoy!