1. Syntax Directed Definition (SDD)
• Syntax Directed Translation (SDT) illustrates the compiling techniques by
developing a program that translates representative programming
language statements into three-address code, an intermediate
representation.
• Syntax directed definition (SDD) is a context-free grammar where
attributes and rules are combined together and associated with
grammar symbols and productions respectively.
Syntax tree is also an Intermediate Representation
- Grammer is given and String is generated => Procedure involves is called PARSER
-SR => Shift-Reduce Parser => Shift means PUSH and Reduce means POP
- Top-Down means Evaluation will start with Grammer and goes to String such as (abaab) ∈ (𝑎, 𝑏) .
- 1st L -> Input string will be read out from left to right and 2nd L means Left-most derivation and ONE (1) means only one input symbol at one time
- No Ambiguous Grammer is accepted in any Parser except “Operator Precedence Parser” can accept.
- In Top-Down, Grammer can not be Left-Recursive or Non-Deterministic.
- In LR: L -> Input string will be read out from left to right and R -> Right-most Derivation in reverse order
- Table Size varies Grammer to Grammer
- Count the variables in production rule => 5
- Count the terminals in the production table => +, *, id, (, ) = 5
- One last column $ is extra
- Total Cells in table required 5 + (5 + 1) = 30 (FOR THIS PARTICULAR GRAMMER)
- ROW representing Variables and Columns representing TERMINALS
- M -> Array or table name; [A, a] = [ROWS, COLUMN] = [VARIABLES, TERMINAL]
- Table Size varies Grammer to Grammer
- Count the variables in production rule => 5
- Count the terminals in the production table => +, *, id, (, ) = 5
- One last column $ is extra
- Total Cells in table required 5 + (5 + 1) = 30 (FOR THIS PARTICULAR GRAMMER)
- ROW representing Variables and Columns representing TERMINALS
- M -> Array or table name; [A, a] = [ROWS, COLUMN] = [VARIABLES, TERMINAL]