4 ms·
> I've seen interleaved lexing and parsing, where the recursive descent parser asks for the next token, which is computed on demand. You even get this for free
by Twisol 3y ago
> I've seen interleaved lexing and parsing, where the recursive descent parser asks for the next token, which is computed on demand.
You even get this for free in a lazy language like Haskell, where your parser can accept a list of tokens `[Token]` whilst the list itself is only computed on-demand whenever the parser tries to get the next one.
Well, except for the context-sensitive option:
> (and as a consequence, it's natural to let lexing be context-sensitive where needed).
- beached_whale 3y agoThis is how I am setup in the little language I am writing in C++. I put the lexer into an iterator.