D parsing

Timothee Cour thelastmammoth at gmail.com
Sat Nov 2 18:45:12 PDT 2013


1)
The main issue I see with pegged is PEG grammars don't support left
recursion, so for example will fail on foo[1].bar(2).fun().
Unless there's a plan to accomodate those, I sense a dead end.
One can eliminate left recursion but this has issues.

2)
There is some material on extending PEG to support those, eg "Left
Recursion in Parsing Expression Grammars", or code
https://github.com/orlandohill/peg-left-recursion but I don't know how well
they work in practice.

3)
Finally, a parser should be as fast as possible; I'm not sure how well
pegged performs compared to dmd frontend. Other promising options are using
lemon, a LALR(1) parser generator.

On Sat, Nov 2, 2013 at 2:17 PM, Andrei Alexandrescu <
SeeWebsiteForEmail at erdani.org> wrote:

> On 11/2/13 1:56 PM, growler wrote:
>
>> On Saturday, 2 November 2013 at 08:19:39 UTC, Philippe Sigaud
>> wrote:
>>
>> [snip]
>>
>>>
>>> Bah, you're getting me all interested in it again! I wanted to write a D
>>> tutorial around a ray-tracer!
>>>
>>
>> I'd like to chime in and say I think Pegged is fantastic.
>>
>> I'm using it for parsing C and Markup in two different projects.
>> I've also just started working on an Octave (well ok, Matlab) M-file
>> parser. It will probably never see the light of day but with
>> Pegged is great fun to play with.
>>
>> Please don't lose interest in it !!
>>
>
> Yes. Probably the most significant D project at this time.
>
> Andrei
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131102/999d13ec/attachment.html>


More information about the Digitalmars-d mailing list