[antlr-interest] Rookie problem

Marko Simovic markobarko at gmail.com
Thu Apr 3 08:00:20 PDT 2008


Hi all,

I've just started using Antlr and I'm having a bit of a problem with a
grammar definiton. I want my grammar to support a language with
multi-word variable names. However, making the adjustment breaks my
if-then conditional recognition.

The grammar at the end of this e-mail works fine for variable names
without spaces. If i change the 'name' definition to the following:

name: String (' ' String)*;

then the 'if' statement can no longer be recognized. What am i doing
wrong?

Thanks,
Marko

grammar test;

String : ('a'..'z' | 'A'..'Z')+;

ConditionOperator
: '<' | '>';

name 
: String;

condition
: name (ConditionOperator name)*;
selection
: 'if' condition 'then' condition;

statement
: selection;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080403/a02faf00/attachment.html 


More information about the antlr-interest mailing list