D Parsing (again)/ D grammar

Vladimir Kazanov via Digitalmars-d digitalmars-d at puremagic.com
Thu Oct 2 11:06:02 PDT 2014


On Thursday, 2 October 2014 at 17:39:55 UTC, Ola Fosheim Grøstad 
wrote:
> On Thursday, 2 October 2014 at 15:47:04 UTC, Vladimir Kazanov 
> wrote:
>> 3. The automatically generated code repeats the original 
>> grammar structure - the same way recursive decent parsers do.
>>
>> 4. The core parser is still that simple LL/RD parser I can 
>> practically debug.
>
> This sounds nice! Does this mean that it would be possible to 
> use your parser generator to create a skeleton which is then 
> manipulated manually or is there non-local complexities that 
> makes manual edits risky?

Chances are that I will be able to get the original GLL parser 
generator from one of algorithm authors (Adrian Johnstone). He's 
really helpful here. From that point, I will only have to add a 
frontend for generating a concrete parser, starting with Python - 
it already has a fully working grammar. Hopefully, I will also be 
able to find a suitable grammar for D, it is always a pleasure to 
play with the language.

Otherwise, I will continue my current effort - implementing the 
GLL parser generator in D.

Anyway, right now, from what I see in the papers, it looks like 
it is quite possible, yes. Again, requires a bit of understanding 
(nothing special, really), but compared to dumb LALR-style tables 
it's nothing.

> One reason I believe GLL is the right way to go is that I think 
> RD makes it easier to generate good error messages suitable for 
> display (to the end user).

This is one of the reasons I prefer LL/RD parsers :-) They are 
easy to follow.


More information about the Digitalmars-d mailing list