Is the grammar spec usable for generating parsers?

Iain Buclaw ibuclaw at gdcproject.org
Sat Nov 3 23:15:56 UTC 2018


On Sun, 4 Nov 2018 at 00:05, Peter Alexander via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Saturday, 3 November 2018 at 22:29:59 UTC, Iain Buclaw wrote:
> > First have a look here, from memory I ended up basing the D
> > grammar in gdb on this version instead.
> >
> > https://libdparse.dlang.io/grammar.html
>
> Thanks.
>
> Unfortunately, it seems that libdparse doesn't know about 'static
> import' and instead parses it as an importDeclaration within a
> 'static' attribute block. I suppose this could be re-interpreted
> after the parsing stage.

Ah, yes.  Indeed that looks correct as per grammar.  In the built up
parse tree, static funcDecl and static importDecl would be storing the
same information, but interpreted differently in semantic.

-- 
Iain


More information about the Digitalmars-d mailing list