[antlr-interest] Strange grammar errors
Jim Idle
jimi at temporal-wave.com
Mon Nov 23 13:42:16 PST 2009
You have a spurious single quote at the end of this line:
| 'if' expression 'then' single_command 'else' single_command'
^
I suggest that you don't use inline 'literals' in the parser, create lexer tokens for them all - when you are starting out, they tend to get you in to trouble :-)
Jim
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Alexandru Nedelcu
> Sent: Monday, November 23, 2009 2:44 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Strange grammar errors
>
> I'm reading "Programming Language Processors in Java" while
> experimenting with Antlr at the same time, and I tried converting the
> first example of a BNF specification to Antlr.
>
> See here (the lines with errors reported are highlighted) ...
> http://pastebin.com/m51e453e4
>
> As you can see it is very simple, and I eliminated left-recursions, but
> I'm getting the errors posted here ...
> http://pastebin.com/m54d656a6
>
> I'm using Antlr 3.2 and ANTLRWorks 1.3.1 for editing. Antlrworks says
> that the grammar is OK, until I try compiling it.
>
> I don't really know what I'm doing wrong, is this a bug? It looks like
> an Antlr syntax-error, but I couldn't figure it out.
>
> Thanks,
>
>
> --
> Alexandru Nedelcu
> http://alexn.org
>
>
> 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