Professional Documents
Culture Documents
A.Krishna Chaithanya Reddy RA2111003011246
A.Krishna Chaithanya Reddy RA2111003011246
∗ Inherited a ributes of the children can depend from both le and right
siblings!
Boolean Expression
Backpatching
• merge(p1,p2) and
• backpatch(p,i)
• makelist(i) : creates a new list containing only i,
an index into the array of instruc ons and
returns pointer to the list it has made.
• merge(i,j) – concatenates the lists pointed to by
i and j ,and returns a pointer to the
concatenated list.
• backpatch(p,i) – inserts i as the target label for
each of the statements on the list pointed to by
p.
CASE Statement
Syntax
searched_case_statement ::=
[ <<label_name>> ]
CASE { WHEN boolean_expression THEN {statement;} ... }...
[ ELSE {statement;}... ]
END CASE [ label_name ];
simple_case_statement ::=
[ <<label_name>> ]
CASE case_operand
{ WHEN when_operand THEN {statement;} ... }...
[ ELSE {statement;}... ]
END CASE [ label_name ];
Usage Notes
After a matching WHEN clause is found, subsequent WHEN clauses are not executed.
The statements in a WHEN clause can modify the database and call non-
deterministic functions.
Assignment Statements
S → id :=E {p = look_up(id.name);
If p ≠ nil then
Emit (p = E.place)
Else
Error;
}
E → E1 + E2 {E.place = newtemp();
Emit (E.place = E1.place '+' E2.place)
}
E → E1 * E2 {E.place = newtemp();
Emit (E.place = E1.place '*' E2.place)
}
1. S → id := E
2. E → E1 + E2
3. E → E1 * E2
4. E → (E1)
5. E → id