[antlr-interest] Cannot understand why interpreter accepts bad input...

Gavin Lambert antlr at mirality.co.nz
Fri Dec 7 13:29:58 PST 2007


At 10:11 8/12/2007, Bern.McCarty at bentley.com wrote:
 >I'm concluding that I should not prototype/modify/develop my
 >grammar by doing edit/interpret cycles.  It is just messing me
 >up.  I guess I have to use edit/debug instead.

I've never had much confidence in the interpreter; it always seems 
to give me weird results.

Also, when you're working at the lexer level (which includes 
adding quoted literals in a combined parser) neither ANTLR nor 
ANTLRworks provides much useful debugging assistance.

At this stage you're much better off writing a standalone test 
harness that:
   - at minimum, takes an input file/string and dumps the 
resulting token stream to an output file (or the screen) for 
manual inspection.
   - ideally, takes a series of input files/strings and verifies 
the output of the lexer matches the corresponding "correct" 
output; ie. a set of unit tests.



More information about the antlr-interest mailing list