ANTLR4-相互左递归语法

时间:2015-11-13 15:16:43

标签: parsing grammar antlr4 left-recursion

我有以下antlr4语法,我得到相互左递归错误,我该如何解决?

expr : expr_prefix term ;
expr_prefix : expr_prefix term addop
            | () ;
term : factor_prefix factor;
factor_prefix : factor_prefix factor mulop
              | () ;
factor : primary 
       | call_expr ;
primary : ( expr ) 
        | id
        | INTLITERAL
        | FLOATLITERAL ;

0 个答案:

没有答案