Grammatical restrictions and efficient evaluation are interconnected in many cases. Thus, the attributes described by L-attributed grammars can be evaluated at parse-time by a top-down parser or after the parse in a single pass down the tree.
The attributes described by S-attributed grammars can be evaluated at parse-time by a bottom-up parser or after the parse by a single pass up the tree.
For unrestricted attribute grammars, tree-walk evaluators may require multiple passes over the parse tree. More efficient evaluators may be obtained by creating a dependency graph from the parse tree and the semantic functions. A dependency graph ensures that the attributes upon which a semantic function depends are evaluated first.
Another task of semantic analysis is creation of an intermediate representation of the program.
Yet another task of semantic analysis is Symbol Table creation.