On Tue Feb 28 11:53:17 EST 2012, ba...@bitblocks.com wrote:
> I have almost always used a handwritten lexer as it seemed about the
> same amount of work and the end result is much smaller and easier to
> understand and lexers for different languages are not all that
> different so once you've written one it is pretty easy to write
> another; and somehow lex or flex interface never felt quite right.

for an extreme example, see /sys/src/cmd/upas/smtp/smtpd.y.

imho, the trick in lexing is to do as little as possible.  context rules
tend to sneak in in the lex phase.  for example, rc's free carets and
willingness to eat newlines under rules that seem obvious until they
need explaining.

- erik

Reply via email to