/    /  Compiler Design-Semantic Phase Errors

Semantic Phase Errors

 

Semantic Errors are recognized during the Semantic Phase. 

 

Some of the semantic errors are:

  • Incompatible operand types
  • Variables that are not declared
  • Formal arguments not matching actual arguments

 

Example:

Int a;

Float b;

a=b;

Here a and b are different data types and are not compatible.

 

Error Recovery

  • A table entry for the corresponding identifier is created when encountered with an “Undeclared Identifier” error.
  • Automatic type conversion is done when encountered with two variables of different data types.

 

Reference Link

Semantic Phase Errors