Pegged: Syntax Highlighting
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Sat Mar 17 10:11:43 PDT 2012
On 3/17/12 9:13 AM, Philippe Sigaud wrote:
>> I want to use Pegged for that purpose. So go ahead an commit the D grammar
>> ;)
>> Would be so awesome if Pegged would be able to parse D.
>>
>> ~Extrawurst
>
> The D grammar is a 1000-line / hundreds of rules monster. I finished
> writing it and am now crushing bugs.
> God, that generates a 10_000 line module to parse it. I should
> simplify the code generator somewhat.
Science is done. Welcome to implementation :o).
I can't say how excited I am about this direction. I have this vision of
having a D grammar published on the website that is actually "it", i.e.
the same exact grammar is used by a validator that goes through all of
our test suite. (The validator wouldn't do any semantic checking.) The
parser generator _and_ the reference D grammar would be available in
Phobos, so for anyone it would be dirt cheap to parse some D code and
wander through the generated AST. The availability of a reference
grammar and parser would be golden to a variety of D toolchain creators.
Just to gauge interest:
1. Would you consider submitting your work to Phobos?
2. Do you think your approach can generate parsers competitive with
hand-written ones? If not, why?
Andrei
More information about the Digitalmars-d-announce
mailing list