Syntax Directed Translation
Syntax Directed Translation
Syntax Directed Translation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Synthesised Attribute: example (ASU Fig 5.2)<br />
S-attributed definition<br />
production<br />
semantic rules<br />
L => E n print(E.val)<br />
E => E 1 + T E.val := E 1 .val + T.val<br />
E => T E.val := T.val<br />
T => T 1 * F T.val := T 1 .val * F.val<br />
T => F T.val := F.val<br />
F => ( E ) F.val := E.val<br />
F => digit F.val := digit.lexval<br />
n = new line, X.val = integer value synthesised attribute, digit.lexval is a<br />
synthesised attribute supplied by the lexical analyser<br />
4<br />
14/10/2014 DFR - CC - SDT