Given my simple grammar in the C# build target:
grammar Expr;
prog: stmt+ EOF;
stmt: expr NEWLINE+;
expr:
expr '^' <assoc=right> expr # Power
| expr ('*'|'/') expr # Mult
| expr ('+'|'-') expr # Add
| REAL # Real
| '(' expr ')' # Paren
;
NEWLINE : '\r\n';
REAL : [0-9]+'.'[0-9]+ ;
I continue to get a C# compiler warning stating that "Warning 1 rule 'expr' contains an 'assoc' terminal option in an unrecognized location"
Can anyone suggest where I'm supposed to indicate right-associativity for exponentials? This is the way I've seen it done in numerous examples.