[antlr-interest] Strange grammar errors
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 :-)
> -----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) ...
> As you can see it is very simple, and I eliminated left-recursions, but
> I'm getting the errors posted here ...
> 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.
> Alexandru Nedelcu
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
More information about the antlr-interest