Re: [作業] 請問compiler中error的問題

作者: sophialiege (with friends)   2007-05-28 22:58:01
lines | lines error '\n' { yyerror(""); yyerrok;}
error 產生 yacc 自動 call 一次 yyerror
lines .... '\n' reduced 前 你又 call 一次 yyerror
所以就做了兩次
至於yyerrok請看
http://www.gnu.org/software/bison/manual/html_mono/bison.html
搜尋yyerrok
the statement yyerrok, a macro defined automatically by Bison;
its meaning is that error recovery is complete
建議: yyerror 放空, 什麼事都不要做
請看看 tinyC.tgz or tinyC++.tgz 的 system.cpp 檔
作者: hahasouliu (微積分爆炸啦!!!)   2007-05-28 23:33:00
感謝~~

Links booklink

Contact Us: admin [ a t ] ucptt.com