Where are the shift/reduce conflicts in this Bison code coming from?

后端 未结 3 547
旧时难觅i
旧时难觅i 2021-01-14 14:39

I\'m trying to parse this syntax:

34 + 1 − 8, 32 * 87 + 6 / 4, 34 / 8

I\'m expecting to ground it like this:

(, (- (+ 34 1)         


        
3条回答
  •  误落风尘
    2021-01-14 15:41

    You did not specify the priority of the operators like,

    %left '+' '-'
    
    %left '*' '/'
    
    (in definition section)
    

    Which can be the reason.

提交回复
热议问题