Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
e   :   primary
    |   primary '^' e // right associative
    |   e '++'
    |   e '.' ID
    |   suffix
    |   ('++'|'-') e // right assoc but how?
    |   suffix
    |   e '*' e
    |   e ('+'|'-') e
    ;

suffix
    :   e '.' ID     |   e '[' e ']'
    |   e '(' e (',' e)* ')'
    ;

primary
    :   '(' e ')'
    |   INT
    |   ID
    ;

...

No Format
e   :   primary
    |   exponent
    |   e '++'
  
 |   unary
    |   e '.' ID // higher than array/method call
    |   suffix
    |   unary
    |   e '*' e
    |   e ('+'|'-') e
    ;

unary
options {associativity = right;}
    :  '++' e
    |   '-' e
    ;

exponent
options {associativity = right;}
    :   e '^' e
    ;

suffix
    :   e '[' e ']'
    |   e '(' e (',' e)* ')'
    ;

primary
    :   '(' e ')'
    |   INT
    |   ID
    ;

...