Spring 2011 CSCI 565 - Compiler Design
Spring 2011 CSCI 565 - Compiler Design
Spring 2011 CSCI 565 - Compiler Design
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Pedro Diniz<br />
pedro@isi.edu<br />
<strong>CSCI</strong> <strong>565</strong> - <strong>Compiler</strong> <strong>Design</strong><br />
<strong>Spring</strong> <strong>2011</strong><br />
Arithmetic Scheme: Grammar and Actions<br />
E → false ‖ E.place = newtemp()<br />
E.code = {gen(E.place = 0)}<br />
E.laststat = E.nextstat + 1<br />
E → true ‖ E.place = newtemp()<br />
E.code = {gen(E.place = 1)}<br />
E.laststat = E.nextstat + 1<br />
E → (E 1 ) ‖ E.place = E 1 .place;<br />
E.code = E 1 .code;<br />
E 1 .nextstat = E.nextstat<br />
E.laststat = E 1 .laststat<br />
E → not E 1 ‖ E.place = newtemp()<br />
E.code = append(E 1 .code,gen(E.place = not E 1 .place))<br />
E 1 .nextstat = E.nextstat<br />
E.laststat = E 1 .laststat + 1