{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

03-02syntaxTreesTypes - Intermediate code Semantic analysis...

Info icon This 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
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern