Le 02/08/2012 20:14, Marco Leise a écrit :
Am Thu, 02 Aug 2012 14:26:58 +0200
schrieb "Adam D. Ruppe"<destructiona...@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 ?
A common solution to that problem is to cancel the computation when user
type something again.