3 ms·
Is that really the hard part? I figured that part out before I knew much programming: made a simple Excel type formula parser. (A horrible, horrible solution ba
by andai 2y ago
Is that really the hard part? I figured that part out before I knew much programming: made a simple Excel type formula parser. (A horrible, horrible solution based around replacing strings and manually counting parentheses... but it worked!)
I never got much farther than that though, I've looked into making a compiler many times and got overwhelmed every time.
- lelanthran 2y agoIt's hard if: 1. You dont recognise the recursive nature of the problem, Or 2. You don't recognise the stack-based nature in the problem (shunting yard algo, etc). IOW, you did it the hard way :-).
- PhilipRoman 2y agoGood to know I wasn't alone in writing terrible expression parsers. Since I knew absolutely nothing about parsing, my parser/interpreter consisted of splitting on whitespace, followed by linear scanning to find the most high precedence operation, repeated until a single token remains (basically how a human would do it).