D Parsing (again)/ D grammar

Daniel Kozak via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 2 07:07:55 PDT 2014


V Thu, 02 Oct 2014 13:49:10 +0000
Vladimir Kazanov via Digitalmars-d <digitalmars-d at puremagic.com>
napsáno:

> Hello, everyone!
> 
> Recently, I have been doing some experimental work related to 
> generalized parser generators. It is not yet ready for a public 
> release, I am not even sure it will ever be. Anyway, right now I 
> am considering adding D as a target for parser generation. 
> Actually, it's more than that: the grand target is to be able to 
> generate a D language parser in D. With Python, for example, it 
> is rather easy, as I can just mechanically transform the original 
> grammar into a suitable form and be done with it.
> 
> The generator itself is quite powerful, theoretically it should 
> be able to handle all context-free grammar (see 
> http://dotat.at/tmp/gll.pdf for theory).
> 
> There is a grammar page on dlang.org 
> (http://dlang.org/grammar.html). I have also found a related 
> discussion in the forum 
> (http://forum.dlang.org/thread/bwsofbnigfbrxwouiobj@forum.dlang.org). 
>  From the discussion I found out that D parser is a hand-made 
> RD-parser with "a few tricks"(c).
> 
> So, my questions:
> 
> 1. How realistic is the grammar? Is it a real one or just a 
> sketch of sorts? Is it something developers use to build the 
> parser?
> 
> 2. There's also a D grammar for Pegged. How good is it? Can it be 
> used as a starting point to build a parser?

https://github.com/Hackerpilot/DGrammar



More information about the Digitalmars-d mailing list