Chapter 5: Semantic Analysis

Why attributes ?

. For lexical analysis and syntax analysis formal techniques were used.

. However, we still had code in form of actions along with regular expressions and context free grammar

. The attribute grammar formalism is important

- However, it is very difficult to implement

- But makes many points clear

- Makes "ad-hoc" code more organized

- Helps in doing non local computations

Attribute grammar is nothing but it is a CFG and attributes put around all the terminal and non-terminal symbols are used. Despite the difficulty in the implementation of the attribute grammar formalism it has certain big advantages which makes it desirable.