[antlr-interest] NoViableAltException remains undetected

Terence Parr parrt at cs.usfca.edu
Tue Feb 9 11:18:29 PST 2010


if it stops at bad input, you might have

startRule : stuff+ ;

instead of

startRule : stuff+ EOF ;

Ter
On Feb 9, 2010, at 10:53 AM, John Pool wrote:

> 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
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address



More information about the antlr-interest mailing list