03-02syntaxTreesTypes

03-02syntaxTreesType - Intermediate code Semantic analysis Part 2 Intermediate representations Topics syntax trees type checking(synthesis vs

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

View Full Document Right Arrow Icon
1 CSE 450: Compilers K. Stirewalt Semantic analysis Part 2: Intermediate representations Topics: – syntax trees – type checking (synthesis vs inference) – function and operator overloading Readings: Read Sections 6.1, 6.3.1 - 6.3.3, and 6.5.1 - 6.5.3 of the Dragon Book CSE 450: Compilers K. Stirewalt Intermediate code Form of a program in between the analysis and synthesis phases of compilation Depending on language, could be different levels (usually 2) of intermediate code Source program High-level intermediate representation Low-level intermediate representation Target code CSE 450: Compilers K. Stirewalt Virtues of intermediate code Separates analysis and synthesis concerns, often simplifying the production of compilers for a variety of languages on a variety of platforms E.g., with a well-designed intermediate form, we could reuse a SpartanAda front-end to build compilers for several architectures Likewise, we might have one highly-optimizing back end that can attach to front-end processors for different languages CSE 450: Compilers K. Stirewalt Common forms of intermediate code Syntax trees – High-level form based on parse trees – Useful in semantic analysis Triples (Three-address code) – Low-level form based on a “universal” assembly language • E.g., t 1 = a + c – Makes simplifying assumptions (e.g., an infinite number of temporary addresses [ t i ] ) Triples can be generated from syntax trees CSE 450: Compilers K. Stirewalt Syntax trees Tree structures derived from parse trees, except
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/25/2008 for the course CSE 450 taught by Professor Stirewalt during the Spring '08 term at Michigan State University.

Page1 / 4

03-02syntaxTreesType - Intermediate code Semantic analysis Part 2 Intermediate representations Topics syntax trees type checking(synthesis vs

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

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