i writing small expression analyser parser project @ company work. parser supposed check, example, division 0 or undefined identifier, report error , stop. best way this? assuming own code has no memory leaks, can this:
if ($3 == 0) { yyerror("division zero"); return 1; }
should rather do:
if ($3 == 0) { yyerror("division zero"); yyerror; }
is there third better alternative?
if call yyerror
explicitly, how using yyabort
? far see, bison
seems perform cleanups @ exit. so, yyabort
or yyerror
more preferable return 1
.
Comments
Post a Comment