Bison loop for conflict

后端 未结 1 1213
一生所求
一生所求 2021-01-26 08:23

to solve the dangling else problem, I used the following solution:

stmt            : stmt_matched
                | stmt_unmatched
                ;
stmt_unmatch         


        
相关标签:
1条回答
  • 2021-01-26 09:16

    Not all for statements are matched. Consider, for example

     if (c) for (;;) if (d) ; else ;
    

    So it is necessary to divide for statements into for_matched and for_unmatched. (And similarly with other compound statements such as while.)

    0 讨论(0)
提交回复
热议问题