tags: systems, compiler design

The semantic analyzer briefly, it checks the semantics of the programs. Semantics mean the meaning of the program, it checks whether the data types match and if the program is written correctly even if we are using a correct grammar and language.

The semantic analyzer outputs an annotated tree with more information about the syntax tree. It does many things related to the correctness of the semantics of the language, like check if the variable is declared, check if the variable used is initialized, it can also do implicit type casting to forgive some errors the programmer did.