Download Syntax Directed Translation PDF

TitleSyntax Directed Translation
File Size853.6 KB
Total Pages51
Document Text Contents
Page 26

Translation Schemes for S-attributed DefinitionsTranslation Schemes for S-attributed Definitions

•• If If our syntax-directeour syntax-directed definition d definition is S-attributed, is S-attributed, the constructiothe construction of n of 

the corresponding translation scheme will be sthe corresponding translation scheme will be simple.imple.

•• Each associated semantic rule in a S-attributed syntax-directedEach associated semantic rule in a S-attributed syntax-directed
definition will be inserted as a semantic action into the end of definition will be inserted as a semantic action into the end of thethe

right side of the associated production.right side of the associated production.

PPrroodduuccttiioonn SSeemmaannttiic c RRuullee

E → EE → E
11
+ + TT EE..vvaal l = = EE

11
.val + T.val.val + T.val  a production of a production of 

a syntax directed definitiona syntax directed definition

⇓⇓
E → EE → E

11
+ T { E.val = E+ T { E.val = E

11
.val + T.val }.val + T.val } the production of the correspondingthe production of the corresponding

translation schemetranslation scheme

Similer Documents