Chapter 10: Code Optimization


9.7 RECOVERY FROM SEMANTIC ERRORS

The primary sources of semantic errors are undeclared names and type incompatibilities. Recovery from an undeclared name is rather straightforward. The first time the undeclared name is encountered , an entry can be made in the symbol table for that name with an attribute that is appropriate to the current context. For example, if missing declaration error of x is encountered, then the error-recovery routine enters the appropriate attribute for x in x 's symbol table, depending on the current context of x . A flag is then set in the x symbol table record to indicate that an attribute has been added, and to recover from an error or not in response to the declaration of x .




Algorithms for Compiler Design
Algorithms for Compiler Design (Electrical and Computer Engineering Series)
ISBN: 1584501006
EAN: 2147483647
Year: 2005
Pages: 108
Authors: O G Kakde

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net