[antlr-interest] Clumsy rewrite syntax for expressions

Guntis Ozols guntiso at latnet.lv
Fri Apr 18 17:18:59 PDT 2008


Hi,
It is strange that rewrite syntax for
  expr (op expr)*
is so complicated (unreadable).

IIUC, a + b + c can only mean one of the following trees:
  +(a, b, c)
  +(a, +(b, c))
  +(+(a, b), c)

How about adding some syntactic support for these 3 cases?
For example:
  ->  ^(op? expr+)
  ->  ^<(op? expr+)
  ->  >^(op? expr+)

Guntis



More information about the antlr-interest mailing list