D parsing
Chad Joan
chadjoan at gmail.com
Mon Nov 4 20:45:39 PST 2013
On Sunday, 3 November 2013 at 01:45:23 UTC, Timothee Cour wrote:
> 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.
>
Use the repetition operator(s) and turn the resulting array into
whatever tree you like. In practice, I have never had a problem
with this.
I have used both Pegged and have written an SQL parser at work
(not exhaustive, just what's needed) that uses C macros as PEG
elements. Tangent: Using C macros for this worked surprisingly
well and allowed me to avoid an extra step in the build process
(I do not have access to D for that project). Pegged is still
much more scalable, optimizable, and the grammars are a lot less
ugly/finicky.
More information about the Digitalmars-d
mailing list