e-machine - 2 ) (8) Out ( V 1 , App 1 ( e 2 , E ) :: K ) 7...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 221 Programming Languages Handout 2 Fall 2005 Nov 23 , 2005 E-machine States s ::= In ( K, E, e ) | Out ( V, K ) Stacks K ::= nil | f :: K Frames f ::= Prim 1 ( op , e 2 , E ) | Prim 2 ( op , V 1 ) | App 1 ( e 2 , E ) | App 2 ( V 1 ) | If 1 ( e 1 , e 2 , E ) Analyze In ( K, E, op ( e 1 , e 2 )) 7→ E In ( Prim 1 ( op , e 2 , E ) :: K, E, e 1 ) (1) In ( K, E, apply ( e 1 , e 2 )) 7→ E In ( App 1 ( e 2 , E ) :: K, E, e 1 ) (2) In ( K, E, if ( e, e 1 , e 2 )) 7→ E In ( If 1 ( e 1 , e 2 , E ) :: K, E, e ) (3) Return value In ( K, E, x ) 7→ E Out ( E ( x ) , K ) (4) In ( K, E, v ) 7→ E Out ( v, K ) (5) In ( K, E, fun f ( x ) is e ) 7→ E Out ([ fun f ( x ) is e ; E ] , K ) (6) Propagate value Out ( V 2 , Prim 2 ( op , V 1 ) :: K ) 7→ E Out (( V 1 op V 2 ) , K ) (7) Move to pending Out ( V 1 , Prim 1 ( op , e 2 , E ) :: K ) 7→ E In ( Prim 2 ( op , V 1 ) :: K, E, e
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 2 ) (8) Out ( V 1 , App 1 ( e 2 , E ) :: K ) 7 E In ( App 2 ( V 1 ) :: K, E, e 2 ) (9) Out ( true , If 1 ( e 1 , e 2 , E ) :: K ) 7 E In ( K, E, e 1 ) (10) Out ( false , If 1 ( e 1 , e 2 , E ) :: K ) 7 E In ( K, E, e 2 ) (11) Out ( V 2 , App 2 ( V 1 ) :: K ) 7 E In ( K, E [ f 7 V 1 ][ x 7 V 2 ] , e ) (12) where V 1 = [ fun f ( x ) is e ; E ] 1...
View Full Document

This note was uploaded on 10/10/2009 for the course CMSC 2210 taught by Professor Macqueen during the Fall '09 term at UChicago.

Ask a homework question - tutors are online