[antlr-interest] syntactic predicates and exceptions

Stephen Quattlebaum stephen at covidimus.net
Tue Nov 15 17:56:55 PST 2005


> This brings us to my second point:  trying to debug a application with 
> Antlr calls.  In C#, NORMALLY in I would just set my debugger to break 
> whenever an exception is thrown, and then hit F5 a few times until I reach

> the bug.  With Antlr, this is no longer possible.  Instead I have to turn 
> off exception trapping, set a breakpoint somewhere near the problem but 
> after the parser has finished, run to the breakpoint, then then re-enable 
> exception trapping to catch the "real" error.  If Antlr is being called in

> a loop, this often requires hacking the code to add some kind of counter
> or if/then test around the breakpoint.  This is what Microsoft means when
> they  say "wade through numerous expected exceptions", and it is a real
> headache.

I would like to second this!  I've spent the last three years dreading
debugging one of my projects that uses an ANTLR-generated-C# to parse
expressions at runtime, b/c the generated code uses exceptions to report
internal, expected conditions, so it results in a lot of "noise" if I turn
on "break on all exceptions", which I like to keep on b/c it helps me find
errors quickly.

- Stephen



More information about the antlr-interest mailing list