Le Sat, 23 Jun 2012 11:03:47 -0700,
Peter Goodman <peter.good...@gmail.com> a écrit :

> Two quick questions:
> - Is there a possible priority inversion because of the separate ordering
> into the categories of non-recursive, directly recursive, or mutually
> recursive?

The ordering within each category is still the original ordering
but the inter-category ordering is mandatory 
-non-recursive
-mutually recursive
-directly recursive
Let's say this is a *feature* which defines the semantic :-)

> - How does this behave with both left and right recursion in the same rule?

Not a problem since the right recursion *must* be preceded
by something different, this means the whole left recursive
production will be exhausted before the right recursion is tried.
You cannot have just  expr := expr expr
What would that be supposed to mean?
Though you *can* have expr := expr + expr

If you want to know more download the source just to read an
example grammar which is in the 'demo.ml' file and looks like that:

A left associative function composition, F ° G ° H

  "composition", [
    "leftrecurs", "" , [NT "composition"; NT "osp"; T"°"; NT "osp"; NT"expr"; S 
composf];
    "initial", "", [NT"expr"];
  ];

A right associative conditional, cond -> then; else

  "conditional", [
     "condition", "", [NT"exprsure"; NT "osp"; T"->"; NT "osp"; NT"exprsure"; 
T";"; NT "osp"; NT "elseclause"; S condition ];
  ];

  "elseclause", [
    "more", "", [NT "conditional"];
    "last", "", [NT"exprsure"; NT "osp"; ];
  ];

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

Reply via email to