D parsing

Robert Schadek realburner at gmx.de
Sun Nov 3 12:46:13 PST 2013


On 11/03/2013 09:13 AM, Philippe Sigaud wrote:
>
> Oh, for D it works (it's even the biggest grammar I know), but it's
> too slow to be of practical interest. But that just means the
> generated parser is not top-notch, which is reasonable: I'm not a
> parsing pro, just a guy doing this during his free time :)
>
>  
>
>     Other promising options are using lemon, a LALR(1) parser generator.
>
>
> My current plan is to write different engines, and letting either the
> user select them at compile-time, or to have the parser decide which
> one to use, depending on the grammar. I'm pretty sure the 'Type 3'
> parts of a grammar (regular expressions) could be bone by using
> std.regex, for example.
>
> I guess I'll have to write a CT-compatible LALR(1) engine...
>  
D does not fit into LALR(1), you need glr.

Another idea would be to make the engine a template argument, and than
combine multiple parser!(engines). And even allow hand written stuff.
This way you could use ll(1) for the ll(1) parts and the crazy hand
written black magic for the hard parts.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20131103/1d3ed780/attachment.html>


More information about the Digitalmars-d mailing list