3 ms·
Another place where lexing and parsing interact is JavaScript. Consider the lexer encountering the text "/x;". If it occurs in code like: let a = /x; the
by evmar 9y ago
Another place where lexing and parsing interact is JavaScript. Consider the lexer encountering the text "/x;".
If it occurs in code like:
let a = /x;
then it needs to continue lexing a regular expression.
If it occurs in code like:
let a = b /x;
then it needs to lex it as division sign, identifier x, semicolon.
- comex 9y agoAt least it's not bad as Perl, where the same code can be parsed as division or a regex depending on the 'type signature' of a function it names: https://www.perlmonks.org/?node_id=663393 https://www.perlmonks.org/?node_id=663393