std.d.lexer requirements

Marco Leise Marco.Leise at gmx.de
Thu Aug 2 11:14:51 PDT 2012


Am Thu, 02 Aug 2012 14:26:58 +0200
schrieb "Adam D. Ruppe" <destructionator at gmail.com>:

> On Thursday, 2 August 2012 at 11:47:20 UTC, deadalnix wrote:
> > lexer really isn't the performance bottleneck of dmd (or any 
> > compiler of a non trivial language).
> 
> What if we're just using this lexer in something like a
> syntax highlighting text editor? I'd be annoyed if it
> stopped typing for a little bit cuz of processing.

My pet peeve for editors is how to make the lexer work on only what I just edited. It is really not trivial, but eased for example by editors that insert closing } automatically, so the scopes don't mess up. A missing curly bracket results in the parser reinterpreting the whole file. The same goes for string terminators:

If I type `` at the top of std.datetime in Mono-D right after "module std.datetime;", I have a 12 (!) seconds wait, till the IDE becomes responsive again.
But if I use ' or ", then the editor inserts the second terminator and is done with reparsing in 1-2 seconds.

Can we really have a good lexer that is equally well suited for compilers as for editors ?

-- 
Marco



More information about the Digitalmars-d mailing list