Official D Grammar

Bruno Medeiros brunodomedeiros+dng at gmail.com
Thu May 2 09:44:49 PDT 2013


On 26/04/2013 21:44, Brian Schott wrote:
> On Saturday, 20 April 2013 at 08:31:34 UTC, Brian Schott wrote:
>> This uses ANTLR, as the other parser generators can't handle D's grammar.
>
> I'm beginning to think that ANTRL is not up to the task either. I've
> somehow managed to get the grammar to the point where it correctly
> parses several phobos modules but takes a half hour to do so.

Half hour??? That seems like a massive amount of time, even if the 
generated parser is very suboptimal and is doing a lot of unnecessary 
backtracking. I mean, even if the parser has quadratic performance over 
typical usage source files, it seems like a lot.

To be honest, that's one of the reasons that put me off working with 
ANLTR. It seems easy to create a parser with ANTLR, but to create an 
efficient, well-behaved parser it looks quite complicated, in the sense 
that you can't abstract yourself from what is happening under the 
hood... you have to read a lot of theory and documention to learn the 
innards of ANTLR, and understand what kind of code it's actually 
generating, and how it processes input. (at moments it feels like you 
have to take a degree to learn how to use it effectively...)

-- 
Bruno Medeiros - Software Engineer


More information about the Digitalmars-d mailing list