D parsing
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Fri Nov 1 14:23:51 PDT 2013
On 11/1/13 1:59 PM, Philippe Sigaud wrote:
> The examples directory shows different grammars, from JSON to XML to C to D.
>
> I used it with the D grammar, but the one on the website is woefully
> inadequate (some mistakes, out of date compared to the compiler and
> written in a somewhat convoluted style full of left-recursion). The
> shortcomings are that the generated parser is quite slow compared to
> other D parsers.
>
> That comes from my coding, of course: Pegged generates a simple
> recursive descent parser. I guess I could push for a better engine, but
> I'm waiting for CTFE to get a bit better.
>
> The advantages are nice, though: full parse tree, semantic actions, and
> so on.
I have long believed, and continue to believe, that this kind of work is
strategic for D. There has been evidence, too - the code I pushed at
work recently included a generated lexer replacing a hand-written lexer
with a generated component, and people did notice. Compile-time and
run-time improvements sealed the deal.
To succeed against established languages, D must not only do well where
others also do well. It's not even enough to do great where others do
well. It must do well (or great!) where others don't even stand a
chance. Regex and Pegged are in that category.
Bugs stopping Pegged from going forward should receive high priority. I
also encourage others to participate to that and similar work.
Andrei
More information about the Digitalmars-d
mailing list