ANTLR grammar for D?

Brian Schott via Digitalmars-d digitalmars-d at puremagic.com
Fri Jun 20 01:55:43 PDT 2014


On Friday, 20 June 2014 at 06:57:31 UTC, Wesley Hamilton wrote:
> I've started making a D grammar for ANTLR4, but I didn't want 
> to spend days testing and debugging it later if somebody 
> already has one.
>
> The best search results turn up posts that are 10 years old. 
> Only one post has a link to a grammar file and the page seems 
> to have been removed. I also assume it would be obsolete with 
> changes to ANTLR and D.
> http://www.digitalmars.com/d/archives/digitalmars/D/25302.html
> http://www.digitalmars.com/d/archives/digitalmars/D/4953.html

https://github.com/Hackerpilot/DGrammar/blob/master/D.g4

It works around a few problems in ANTLR by combining a bunch of 
rules that should be separate into the unaryExpression rule, but 
it does build and produce a parse tree now. (I have no idea if 
the parse trees are always correct)


More information about the Digitalmars-d mailing list