Bison - recover from If Else error
问题 I'm trying to recover from an error in an If-Else statement. In my grammar an If is always followed by an Else. statement: OBRACES statements CBRACES | IF OPAR exp CPAR statement ELSE statement | IF OPAR exp CPAR statement error '\n' { yyerrok; yyclearin;} ; The error found is in the commented else in the last lines: public boolean Equal(Element other){ if (!this.Compare(aux01,Age)) ret_val = false ; //else //nt = 0 ; } error: syntax error, unexpected CBRACES, expecting ELSE -> } @ line 29 It