Chapter 2: Introduction to compilers

More on Semantic Analysis

 

. Compilers perform many other checks besides variable bindings

. Type checking Amit left her work at home

. There is a type mismatch between her and Amit . Presumably Amit is a male. And they are not the same person.

From this we can draw an analogy with a programming statement. In the statement:

double y = "Hello World";
The semantic analysis would reveal that "Hello World" is a string, and y is of type double,

which is a type mismatch and hence, is wrong.