[antlr-interest] Parse failing, not sure why

Jim Idle jimi at temporal-wave.com
Fri Feb 3 12:20:22 PST 2012


Don't use the interpreter, use the debugger - you will likely have better
results.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Nick La Rooy
> Sent: Friday, February 03, 2012 11:47 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Parse failing, not sure why
>
>
> I'm writing a grammar for Small-C.
>
> As far as I can tell, my grammar matches the language specification.
>
> ANTLR generates the Java code with no hiccups.
>
>
> However, in the interpreter, ANTLR does not seem to be matching rules
> that it could match, and instead is returning mismatch exceptions.
>
>
>
> Glaring example:
>
>
> Given:
>
> main()
> {
>     return 1;
> }
>
>
> The interpreter sends back:
>
> MismatchedTokenException: line 1:5 mismatched input ')' expecting
> '\u0016'
>
>
> But this rule should match:
>
> main : MAIN LPAREN RPAREN body ;
>
>
>
> What could be causing this?
>
> Does rule declaration order make a difference?
>
>
>
> Grammars are attached.
>


More information about the antlr-interest mailing list