Hi Justin,

On 02/12/2010 7:53 PM, Justin Chase wrote:
> I have an implementation for .net also: 
> http://metasharp.codeplex.com/
> 
> Which is a lot different but the general goal is the same :)

Jeff Moser also has an implementation in C#: http://ometasharp.codeplex.com/

> In your example rules below, isn't that just indirect left recursion?
> If not how is it different? In Warth's paper he explains how to solve
> the problem of indirect left recursion and while I was attempting to
> implement it I was running into a lot of problematic cases such as
> multiple levels of indirect left recursion. For example your C rule
> lacks a reference to A, was that intentional? It can get very
> complex. Additionally C references B which is another layer of
> indirect left recursion.

As was discussed on the OMeta list last year
(https://lists.csail.mit.edu/pipermail/peg/2009-November/000246.html),
Warth's algorithm does not correctly handle this grammar.  It gets
caught bouncing between the A and B rules, and never sees the C rule.

Medeiros's algorithm correctly finds the C rule.

> I asked about it on the forums here and the consensus was that while
> iLR is possible, it's not completely clear that it's actually
> desirable. It may result in an increased complexity of grammars for
> those who are authoring the grammars and make it hard to reason about
> unexpected results. I would be interested to hear evidence
> otherwise.

LR is useful for handling operator precedence, for example.  I'm afraid
that I have no evidence that indirect left-recursion does not result in
increased complexity -- being able to handle the increased complexity
was the attraction for me in implementing the algorithm.

Cheers,

Gordon

-- 
Gordon Tisher
http://balafon.net


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

Reply via email to