The attached picture shows that even when I assign right association to '^' I am getting a left association.
Here is my sample grammer:
grammar testParser;
program
: expr* EOF
;
expr
: expr '^'<assoc=right> expr // ^ operator is right associative
| expr '*' expr // match subexpressions joined with '*' operator
| expr '+' expr // match subexpressions joined with '+' operator
| INT // matches simple integer atom
;
INT
: [0-9]+
;
WS
: [ \n\t\r]+ -> skip
;
My input:
1^2^3
What the parser sees:
(1^2)^3
What I want the parser to see:
1^(2^3)
How do I get my intended output?
The attached picture shows my exact code, input, and output.
I apologize if I have made a glaring mistake, and I appreciate your input.