Versions Compared

Key

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

...

The beauty of this is that it would automatically know how to build ASTs (or with a little bit of help from you for the complicated ones like method calls and array indexing). Further, the precedence specified as usual by the order of the alternatives. Anything that starts and stops with e is considered a binary (or possibly trinary) operator. Any other alternative that starts with e is a suffix operation. Any other alternative that ends with e is a unitary operation. Alts that are simply rule references identify groups of operations at the same level such as the suffix rule.

Perhaps as Gavin Lambert oointed pointed out, we simply need to do associativity with an option:

...