Apr26 - L.addr = new Temp() gen(L.addr = E.addr *...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE302: Compiler Design Instructor: Dr. Liang Cheng Department of Computer Science and Engineering Lehigh University April 26, 2007
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/26/07 Outline ± Recap of 3-address code generation ± Array references ± Review and feedback
Background image of page 2
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/26/07 SDT of Array Type Declaration ± D T id; {top.put(id.lexeme, T.type, T.width);} ± T B {t = B.type; w = B.width;} C { T.type = C.type; T.width = C.width; } ± B int {B.type = integer; B.width = 4;} ± B float {B.type = float; B.width = 8;} ± C [ num ] C1 { C.type = array( num .value, C1.type); C.width = num .value × C1.width; } ± C →ε {C.type = t; C.width = w;}
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/26/07 Translation of Array References ± L id [ E ] ± L.array = top.get(id.lexeme) ± L.type = L.array.type.elem
Background image of page 4
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: L.addr = new Temp() gen(L.addr = E.addr * L.type.width) L L1 [ E ] L.array = L1.array L.type = L1.type.elem t = new Temp() L.addr = new Temp() gen(t = E.addr * L.type.width ) gen(L.addr = L1.addr + t) S id = E ; S.code = E.code || gen(top.get(id.lexeme) = E.addr) E L E.addr = new Temp() gen(E.addr = L.array.base [ L.addr ]) S L = E ; gen(L.array.base [ L.addr ] = E.addr Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/26/07 Outline Recap of 3-address code generation Review and feedback Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/26/07 Course Evaluation Instructor: Dr. Liang Cheng CSE302: Compiler Design 04/26/07 Suggestion and Comments?...
View Full Document

This note was uploaded on 08/06/2008 for the course CSE 302 taught by Professor Cheng during the Spring '07 term at Lehigh University .

Page1 / 7

Apr26 - L.addr = new Temp() gen(L.addr = E.addr *...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online