开发者

Grammar to recognize postfix formulas

开发者 https://www.devze.com 2023-03-16 02:44 出处:网络
I\'m trying to create a postfix to infix converter, and I\'m unable to create the grammar for postfix formulas. I\'ve been also looking for it for a while without success..

I'm trying to create a postfix to infix converter, and I'm unable to create the grammar for postfix formulas. I've been also looking for it for a while without success..

What grammar开发者_运维知识库 could I use to recognize valid postfix expressions?

The tokens I need are: number, +, * and ^ (pow).


I would suggest

E ::= number | E E + | E E * | E E ^


Valid in what sense? Resulting in one value?

B ::= number | B B O
O ::= + | * | ^
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号