2

私はこの文法を書きました:

/* Precedences */ 
precedence left UMINUS;
precedence left ID;

Expr ::=      ID:e              
    | NUM:e             

    | Expr:e1 TIMES Expr:e2     

    | LP Expr:e RP          

    ;

Call ::= ID:id LP  ExprComma:args RP  ; 

このプログラムでパーサーを実行しようとすると:

weirdAverage(5)

(トークンは次のとおりです: id lp num(expr) rp)

私は得る:

 Syntax error in line 1 '('

だから、私はこれを削除しようとします:

 precedence left ID;

そして今、私はエラーを受け取ります:

   [java] Warning : *** Shift/Reduce conflict found in state #16
 [java]   between Expr ::= ID (*) 
 [java]   and     Call ::= ID (*) LP ExprComma RP 
 [java]   under symbol LP
 [java]   Resolved in favor of shifting.
 [java] Warning : *** Shift/Reduce conflict found in state #79
 [java]   between Expr ::= ID (*) 
 [java]   and     Call ::= ID (*) LP ExprComma RP 
 [java]   under symbol LP
 [java]   Resolved in favor of shifting.
 [java] Error : *** More conflicts encountered than expected -- parser generation aborted
4

0 に答える 0