[antlr-interest] Compiler design workflow - any suggestions?
Mark Lentczner
markl at glyphic.com
Tue May 4 13:52:06 PDT 2004
> In the regular programming domain I would use JUnit and automated test
> cases to make sure new things don't break old things.
Indeed, I use our own C++ unit testing framework to do the same,
testing at each phase of the translation: lexer (text --> tokens)
parser (tokens --> AST)
compiler (AST --> instructions)
method-builder (instructions --> bytecodes)
The first three are Antlr grammars.
A more detailed description of how this is done, with pointers to the
actual code and unit tests can be found at:
http://www.wheatfarm.org/wiki/CompilerImplementation
Briefly, the unit tests for the lexer and parser are done by writing
the resulting token stream or AST to a simple string form and the
comparing strings. The compiler is tested by comparing against hand
compiled code, byte for byte.
I'd be happy to answer any specific questions about this sort of
testing you might have.
- Mark
Mark Lentczner
markl at wheatfarm.org
http://www.wheatfarm.org/
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/antlr-interest/
<*> To unsubscribe from this group, send an email to:
antlr-interest-unsubscribe at yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list