Let's stop parser Hell

Philippe Sigaud philippe.sigaud at gmail.com
Thu Jul 5 11:16:48 PDT 2012


>> On 2012-07-05 18:32, Roman D. Boiko wrote:
>>
>>> My vote would be for Pegged, I guess.

As much as I'm flattered by that, my current impression is Pegged is very
far from being performant.

As a proof-of-concept that, in D,  it's possible to parse a string and
create a parse tree at compile-time and then generate code from this, it's
also successful. Go D!

As a parser proper, Pegged is awful :-) Nothing I'm ashamed of, as I learn
by coding. Hey, I just received the Dragon Book (International Edition),
I'm sure I'll learn many things in there.

So, if anyone is willing to change the code generated by Pegged, I'm game.
The results you showed me on keyword parsing are very interesting!

But, my impression is that the need for a 'D'-only parser and lexer is far
greater and much more imediate that the need for a parser generator. All
the reasons advanced upthread ask for a D parser, not a generic generator.
Parser generators are for those of us interested in having DSLs or macros
in D.
So Pegged or any other generator should *not* get the community focus right
now.

My plan would be as follow:

1- assemble a group of people knowing parsing. I don't think I'm exactly
knowledgeable, but I'm ready to be part of such a group.
2- create a github process.
3- translate an existing parser / adapt a D parser for Phobos. I'm ready to
be part of this (I'm sure I'll learn in the process)
4- spend 1-2 years fighting over LR parsing and such :) (Just kidding)
5- submit it to Phobos and have it adopted.

much later:
6- see the way the parser code is organized and tweak a code generator
(Pegged is a possibility if recursive parsing is OK) to produce an
equivalent code when fed the D grammar.

side-effect: maybe a std.tree or std.collection.tree to deal with trees in
a generic way.

Philippe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120705/0053bf68/attachment.html>


More information about the Digitalmars-d mailing list