4 ms·
Yes, but it doesn't need any funny parsing trick to handle them. Just parse the whole statement as a list of expressions joined by operators, and then you can c
by aappleby 6mo ago
Yes, but it doesn't need any funny parsing trick to handle them. Just parse the whole statement as a list of expressions joined by operators, and then you can convert the flat list into a precedence-respecting tree with a few lines of code and an operator-to-precedence table.
- childintime 6mo agoYes, it's as easy as that. Or check out Jonathan Blow on precedence. The infamous dragon book convinced people to use the wrong tools and have the wrong mindset. It was a work of incompetence. There were no dragons, but the book itself.