This preview shows pages 1–16. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: TypeChecking II Announcements Written Assignment 2 Due Monday at 5:00PM. Office hours today, Sunday, and Monday. Ask questions on Piazzza! Email the staff list with questions! Midterm next Wednesday in class, 11:00 1:00. Midterm review session next Monday in class. We'll post practice midterms online. Midterm covers all of scanning and parsing, but not semantic analysis. Openbook, opennotes, opencomputer, closednetwork. OH switch next week: Monday office hours in Gates B24A, Friday office hours in Gates 160 at the scheduled times. Where We Are Lexical Analysis Semantic Analysis Syntax Analysis IR Generation IR Optimization Code Generation Optimization Source Code Machine Code Review from Last Time Static type checking in Decaf consists of two separate processes: Inferring the type of each expression from the types of its components. Confirming that the types of expressions in certain contexts matches what is expected. Logically two steps, but you will probably combine into one pass. Review from Last Time while (numBitsSet(x + 5) <= 10) { if (1.0 + 4.0) { /* */ } while (5 == null) { /* */ } } Review from Last Time while ( numBitsSet(x + 5) <= 10 ) { if (1.0 + 4.0) { /* */ } while (5 == null) { /* */ } } Review from Last Time while (numBitsSet(x + 5) <= 10) { if ( 1.0 + 4.0 ) { /* */ } while (5 == null) { /* */ } } Review from Last Time while (numBitsSet(x + 5) <= 10) { if ( 1.0 + 4.0 ) { /* */ } while (5 == null) { /* */ } } Welltyped expression with wrong type. Review from Last Time while (numBitsSet(x + 5) <= 10) { if (1.0 + 4.0) { /* */ } while ( 5 == null ) { /* */ } } Review from Last Time while (numBitsSet(x + 5) <= 10) { if (1.0 + 4.0) { /* */ } while ( 5 == null ) { /* */ } } Expression with type error Review from Last Time We write S e : T if in scope S , the expression e has type T . Review from Last Time S f(e 1 , ..., e n ) : U f is an identifier. f is a nonmember function in scope S. f has type (T 1 , , T n ) U S e i : T i for 1 i n Read rules like this Review from Last Time S f(e 1 , ..., e n ) : U f is an identifier. f is a nonmember function in scope S. f has type (T 1 , , T n ) U S e i : T i for 1 i n Review from Last Time We say that A B if A is convertible to B. The least upper bound of A and B is the class C where A C B C C C' for all other upper bounds. The least upper bound is denoted A B when it exists. A minimal upper bound of A and B is an upper bound of A and B that is not larger than any other upper bound. Review from Last Time S f(e 1 , ..., e n ) : U f is an identifier....
View
Full
Document
This document was uploaded on 07/18/2011.
 Spring '09

Click to edit the document details