Le 14/05/2012 21:21, Roman D. Boiko a écrit :
On Monday, 14 May 2012 at 19:13:39 UTC, Roman D. Boiko wrote:
On Monday, 14 May 2012 at 19:04:20 UTC, Tove wrote:
What if there were two different lex:er modes... with different
struct:s.

1. For an IDE with on the fly lexing:
Assumption, the error rate is high.(need to keep much info)

2. For the compiler
Assumption, the error rate is non existent, and if there is an error
it really doesn't matter if it's slow.

So... when choosing the "compiler mode"... and there actually is an
error, then just lex it again, to produce a pretty error message ;)
...
The problem with multiple lexer implementations is that it might
become much more difficult to maintain them.
Just to clarify: different modes in lexer in my view are like two
different implementations combined in a non-trivial way (unless
the difference is minor). So complexity goes from two factors:
different implementations and how to combine them. I try to avoid
this.

If both have the same interface, metaprograming can do the magic for you.

Reply via email to