presentation slides compiler construction
SDT is done by attaching rules to productions in a grammar
Every node of the abstract syntax tree is attached with certain attribute set
Example :
E---- E+T {E.val=E.val+T.val}
3. Types of SemanticAction Performed by:
■ Scope Resolution
■ Type Checking
■ Array Bound Checking
4. Syntax DirectedTranslation (SDT)
■ SDT is done by attaching rules to productions in a grammar
■ Every node of the abstract syntax tree is attached with certain attribute set
Example :
E---- E+T {E.val=E.val+T.val}
7. To help semantic analysis we need some
tools :
■ Semantic Rules (Syntax Directed Definition )
Example
■ Semantic Action (Syntax DirectedTranslation)
Example