2 ms·
> How do you determine what should be part of the lexing phase and what should be part of the parsing phase? Recursion. If your thing can contain other things,
by matheusmoreira 4y ago
> How do you determine what should be part of the lexing phase and what should be part of the parsing phase?
Recursion. If your thing can contain other things, it requires a full parser. Otherwise a lexer can handle it.
In other words, use a lexer when a regular language is sufficient to describe the input and a parser when it's not.
Lexer:
12345
Parser:
[123 [45]]