分流场VS递归下降解析器 [英] Shunting-Yard VS Recursive Descent Parser

查看:88
本文介绍了分流场VS递归下降解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个高级数学解析器,并且想知道Shunting-Yard与其他可用的解析器算法(例如下降解析器")之间的区别,因为我希望将公式存储为RPN表示法.

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.

预先感谢

推荐答案

"shunting yard"算法从未使用过很多,因为它似乎只针对中缀表达式.递归下降解析很容易完成表达式以及使用更复杂的解析器进行的大多数操作.更一般地说,我发现它更有用,并且不需要记住两种技术.

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.

在此处查看有关如何构建递归下降解析器的SO解答:

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?

这篇关于分流场VS递归下降解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆