-->

Shunting-Yard VS Recursive Descent Parser

2019-02-27 09:54发布

问题:

I am building an advanced mathematical parser and would like to know the difference between Shunting-Yard and the other available parser algorithms like "Descent Parser" knowing that I prefer to store the formula in RPN notation.

Thanks in advance,

回答1:

I've never had much use for the "shunting yard" algorithm because it seems focused on just infix expressions. Recursive descent parsing easily does expressions and most of what you want to do with more complex parsers. Being more general, I find it more useful, and don't need to remember two techniques.

See my SO answer on how to build recursive descent parsers here: Is there an alternative for flex/bison that is usable on 8-bit embedded systems?