123
Postfix Translation
In a production A → α, the translation rule of A.CODE consists of the concatenation of the CODE translations of the non-terminals in α in the same order as the non-terminals appear in α.
Production can be factored to achieve postfix form.
Postfix translation of while statement
The production
Can be factored as:
A suitable transition scheme would be
Production Rule | Semantic Action |
---|---|
W → while | W.QUAD = NEXTQUAD |
C → W E do | C W E do |
S→ C S1 | BACKPATCH (S1.NEXT, C.QUAD) S.NEXT = C.FALSE GEN (goto C.QUAD) |
Postfix translation of for statement
The production
Can be factored as
Next TopicArray References