Analysis of syntax directed definition

Syntax directed definations: Are a generalizations of context-free grammars in which

  1. Grammar symbols have an associated set of Attributes.
  2. Productions are associated with Semantic Rules for computing the values of attributes.

The value of an attribute of a grammar symbol at a given parse-tree node is defined by a semantic rule associated with the production used at that node.

For Example :

Let us consider the Grammar for arithmetic expressions. The Syntax Directed Definition associates to each non terminal a synthesized attribute called val.

ProductionSemantic rule
L à Enprint(E.val)
E à E1 + TE.val := E1.val + T.val
E à TE.val := T.val
T à T1 * FT.val := T1.val * F.val
T à FT.val := F.val
F à (E)F.val := E.val