Closed DistinctWind closed 1 year ago
一元减法运算符跟二元减法运算符的token是完全相同的,但是我们没什么办法给同样的一个token赋两个不同的优先级(一元减法的优先级要高于二元减法)。
那在bison中怎么做到这一点呢?
我发现bison文档中有一小节讲了这个问题,应该能使用占位优先级来解决这个问题
bison文档中的另一小节甚至讲解了if/else的移入/规约冲入问题,以后可以参考。
一元减法运算符跟二元减法运算符的token是完全相同的,但是我们没什么办法给同样的一个token赋两个不同的优先级(一元减法的优先级要高于二元减法)。
那在bison中怎么做到这一点呢?