Dlang grammar

max haughton maxhaton at gmail.com
Fri May 6 22:24:33 UTC 2022


On Friday, 6 May 2022 at 21:03:02 UTC, Alexandru Ermicioi wrote:
> Hello,
>
> Is there somewhere a proper grammar file for D language, that 
> you can easily feed into a parser generator, and get out of it 
> nicely baked parser (preferably parser in Java)?
>
> Tried to search for such grammars, and no luck. Found of course:
> 1. https://dlang.org/spec/grammar.html
> 2. https://libdparse.dlang.io/grammar.html
>
> I've tried both of them to adapt to antlr4 but eventually 
> failed (requires a lot more effort than I have willpower for 
> it). First for some reason got out of memory exception, while 
> for the latter it is plainly incomplete, and also with couple 
> of mistyped words, even if it is generated from libdparse.
>
> Thanks for the tips,
> Alexandru.

Vladimir and a few others have an effort to do a tree-sitter 
grammar for D. That's the closest anyone has come in recent years 
at least.

What do you want the grammar for?


More information about the Digitalmars-d mailing list