On Wed, Apr 13, 2011 at 11:22:39AM -0700, Terence Parr wrote:
> rpexpression : rpexpression_ ;
> rpexpression_
>    :   rpexpression_primary
>        ( ( rpexpression OPERATOR ) )*
>    ;
> rpexpression_primary
>    : OPERAND
>    ;

My original version:
> 
> rp-expression <- rp-expression rp-expression operator / operand
>

Those result in completely different parse trees, is the problem.

Given:

5 4 * 2 1 - +

The original gives:

rp-expression <-
  rp-expression=(
    rp-expression=(operand=5) rp-expression=(operand=4) operator=*)
  )
  rp-expression=(
    rp-expression=(operand=2) rp-expression=(operand=1) operator=-)
  )
  operator=+

The new one gives:

...

The new one simply doesn't work; it can't match a nested construct
unless its first segment is a bare operand, as far as I can tell.

-Robin

-- 
http://singinst.org/ :  Our last, best hope for a fantastic future.
Lojban (http://www.lojban.org/): The language in which "this parrot
is dead" is "ti poi spitaki cu morsi", but "this sentence is false"
is "na nei".   My personal page: http://www.digitalkingdom.org/rlp/

_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to