DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
yacc

Error handling

The input to the parser will sometimes not conform to the specifications. If no provision has been made to deal with errors, the processing halts when an error is detected. Instead of stopping all processing when an error is found, it is often more useful to continue scanning the input to find other syntax errors. Some of the problems associated with error handling are semantic ones. When an error is found, for example, it may be necessary to reclaim parse-tree storage, delete or alter symbol-table entries, or set switches to avoid generating any further output.

Error handling mechanisms can be provided as part of the input specifications. This permits the reentry of data after bad data has been seen, or the continuation of the input process after skipping over the bad data. This leads to the problem of where parser should resume parsing after an error. A general class of algorithms to do this involves discarding a number of tokens from the input string and attempting to adjust the parser so that input can continue.


Next topic: Error token
Previous topic: Assigning a precedence to grammar rules

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003