Request for comments: std.d.lexer

Philippe Sigaud philippe.sigaud at gmail.com
Sun Jan 27 12:18:38 PST 2013


> I concur. One of the biggest reason* there is a separate lexer step is
> because it could be made to do this stage very-very fast. Then the rest of
> the parser will greatly benefit from this underlying speed.
>
> *Otherwise we could have just as well add the lexer stage as simple rules to
> the grammar that treats all of codepoints as terminals.

... which is exactly what parsing expression grammars (and other
scannerless parsers) do.

AFAICT, one interesting consequence is the ability to have composition
of grammars, which I sure have with Pegged. But maybe it's not related
that much, that's not something I stopped to think about.
In any case, grammar composition is something I've learnt to like quite a lot.


More information about the Digitalmars-d mailing list