Shunting-Yard VS Recursive Descent Parser

2019-02-27 09:39发布

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条回答
聊天终结者
2楼-- · 2019-02-27 10:00

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?

查看更多
登录 后发表回答