29.04.2015 Views

Syntax Directed Translation

Syntax Directed Translation

Syntax Directed Translation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Summary<br />

• syntax-directed translations -<br />

grammar + semantic rules<br />

– synthesised attributes<br />

– inherited attributes<br />

– b := f(c 1 , c 2 , c 3 , …, c k )<br />

• S-attributed definition<br />

– only synthesised attributes<br />

• dependency graphs<br />

• constructing syntax trees<br />

– syntax-directed definition<br />

• DAGs for expressions<br />

• bottom up evaluation of S-<br />

attributed definitions<br />

• L-attributed definitions<br />

– inherited attributes depend<br />

on A and left siblings A => α<br />

• translation schemes<br />

– CFG + attributes + semantic<br />

actions in { } in RHS of P<br />

• top down translation<br />

– left recursive grammar<br />

– right recursive grammar<br />

– X.i & X.s attributes<br />

22<br />

14/10/2014 DFR - CC - SDT

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!