'Lexing "1 -1". How does a lexer decide its 1 - 1 instead of just two numbers next to each other?
I'm new to writing compilers, and I want to know the proper solution to this problem. Currently if there is the possibility of two different tokens I chose the one that is longer - it works, but I want to know if there is a more elegant solution.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
