[antlr-interest] NoViableAltException remains undetected

John Pool j.pool at ision.nl
Tue Feb 9 10:53:51 PST 2010


I have a grammar for which the parse tree in the ANTLRWorks interpreter
correctly shows a NoViableAltException-box for certain input sentences. In
my C# test rig, however, this exception is not thrown. The parser simply
stops at the erroneous input (as if it were an <EOF>), which can be seen
from the generated AST, in which everything after the last correct symbol is
missing. 

I am quite certain that no parser exception occurs, as I (1) have overridden
both the lexer and the parser ReportError and (2) put breakpoints on every
try/catch I could find in the parser/lexer code. Are there, generally
spoken, any conceivable circumstances under which this can happen? 

Of course I have tried to step through the code using the C# debugger, but I
lost track of what was actually happening, te more so as I cannot see what
is going on in the Antlr.Runtime dll. 

Any help would be welcome. I am aware that without seeing the actual grammar
and code it might be hard to figure out what is going on, but I am just
wondering if there is some general approach that I can take before
submitting code. 

Kind regards, 

John Pool



More information about the antlr-interest mailing list