lex - Stop program execution when there is error -
i like stop execution of program when facing error. how when using lex? can call normal c exit like:
exit( status );
or there more neat way lex?
you can - but:
- just printing message standard error , exiting lex does—when encounters fatal error, e.g., buffer allocation problems. see example yy_fatal_error, used purpose. can overridden, e.g., error recovery routine.
- a typical lexer not exit error: returns state information parser decides whether state legal.
if lexer serves parser, exiting lexer make sense.
further reading:
Comments
Post a Comment