This document discusses semantic analysis in compilers. It begins by defining semantics and semantic analysis, and provides an example of a syntactically valid but semantically invalid statement. It then discusses how semantic rules are associated with a context-free grammar to perform semantic analysis. It describes the annotated parse tree output of semantic analysis and how semantic rules are associated with grammar productions. The document discusses different ways to represent semantic rules like syntax-directed definitions and attribute grammars. It also covers different types of attributes like synthesized and inherited attributes. Finally, it discusses applications of semantic analysis like type checking and generating intermediate code.