9 ms·
Yes. I don't think anyone is disagreeing here. If you're implying that we should then use a regex implementation instead: Coding up a lexer (for a mainstream p
by jstimpfle 8y ago
Yes. I don't think anyone is disagreeing here.
If you're implying that we should then use a regex implementation instead: Coding up a lexer (for a mainstream programming language) using simple counter increments and such is not a lot of work. It has the advantage that it results in faster code (unless you're going for real heavy machinery) and that you can easily code up additional transformations. For example, how would you parse string literals (including escape sequences) with a regex?
- mcguire 8y ago"(.|\.)*"
- jstimpfle 8y ago"Evaluation:\tWrong!\x07\x07\x07\r\n" You want to convert the string literal to an internal buffer, interpreting the escape sequences. In the same way, you want to parse integers. You cannot really do that with a regular expression. RE is for matching, not for transforming.
- jcranberry 8y agoString literals are easy without escaped quotes. With escaped quotes its annoying and non regex is much cleaner.