Questions tagged «shunting-yard»

3
调车场算法中函数的优先级
如维基百科所述,我正在研究调车场算法。 与运算符打交道时的算法描述如下: 如果令牌是运算符,则为o1,则: 而在运算符堆栈的顶部有一个运算符令牌o2,或者 o1 is left-associative and its precedence is less than or equal to that of o2, or o1 is right associative, and has precedence less than that of o2, 然后将o2从运算符堆栈中弹出,进入输出队列; 将o1推入操作员堆栈。 但是,他们给出了以下示例: 输入: sin max 2 3 / 3 * 3.1415 当算法命中/令牌时,对应该发生的情况的描述如下: Token | Action | Output …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.