Shunting-Yard VS Recursive Descent Parser

人盡茶涼 提交于 2019-12-04 04:48:56

问题


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?



来源:https://stackoverflow.com/questions/35257594/shunting-yard-vs-recursive-descent-parser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!