Pegged: Syntax Highlighting

Philippe Sigaud philippe.sigaud at gmail.com
Sat Mar 17 11:40:18 PDT 2012


On Sat, Mar 17, 2012 at 15:44, Extrawurst <spam at extrawurst.org> wrote:
> On 17.03.2012 15:13, Philippe Sigaud wrote:
>>
>> The D grammar is a 1000-line / hundreds of rules monster. I finished
>> writing it and am now crushing bugs.
>
>
> Any ETA when u gonna commit it for the public ? Wouldn't mind getting my
> hands dirty on it and looking for bugs too ;)

I just pushed it on Github.

pegged/examples/dgrammar.d just contains the D grammar as a string.
pegged/examples/ddump.d is the generated parser family.

There are no more syntax bugs, Pegged accepts the string as a correct
grammar and DMD accepts to compile the resulting classes.
I tested the generated parser on microscopic D files and... it
sometimes works :)

I made many mistakes and typos while writing the grammar. I corrected
a few, but there are many more, without a doubt

I'll write a wiki page on how to generate the grammar anew, if need be.

Btw, the D grammar comes from the website (I didn't find the time to
compare it to the grammar Rainer uses for Mono-D), and its horribly
BNF-like: almost no + or * operators, etc. I tried to factor some
expressions and simplify some, but it could be a bit shorter (not
much, but still).


More information about the Digitalmars-d-announce mailing list