Re:On the Complexity and Performance of Parsing with Derivat...
by wolfgke on Saturday June 25, 2016 @01:13PM
(#11977043)
If you want to write a lexer from scratch, this is IMHO not trivial. If you use a generator it is much easier, but so is also using a parser generator for the CFG parsing stage.
[ Parent
| on HN ]
Re:On the Complexity and Performance of Parsing with Derivat...
by jblow on Saturday June 25, 2016 @05:54PM
(#11978173)
If you can't write a lexer by hand, just forget trying to write a compiler that does anything interesting, because the lexer is MUCH easier than any other part of the compiler.
There are a lot of reasons for this, but one of the basic ones is that the lexer does not need to interact in a complex way with the compiler's state. It is a relatively simple pipeline where characters go in one end and tokens come out the other.
Re:On the Complexity and Performance of Parsing with Derivat...
by SamReidHughes on Saturday June 25, 2016 @01:38PM
(#11977161)
Hand-rolling a lexer seems pretty trivial to me. The code writes itself. A generator is a tool whose limitations you have to work around, be it for a lexer or a parser.