270 likes | 406 Views
CSE-321 Programming Languages Evaluation Contexts. 박성우. POSTECH April 16, 2007. Simply Typed -Calculus. 18 Reduction Rules. Simpler?. Outline. Evaluation contexts Abstract machine C. Reduction Rules. Derivation Trees. Reducing an Expression e.
E N D
CSE-321 Programming LanguagesEvaluation Contexts 박성우 POSTECH April 16, 2007
Outline • Evaluation contexts • Abstract machine C
Reducing an Expression e • Locate an appropriate subexpression (redex) of e • Apply a corresponding reduction rule
Decompose and Apply Expression = Redex + Context remaining intact
Evaluation Contexts (CBV) • An expression with a hole ¤ in it • The hole ¤ indicates the position of a subexpression to be reduced in the next step,i.e., the redex for the next step. • Example:
Reduction Strategy • Determined by the definition of evaluation contexts call-by-value call-by-name
Outline • Evaluation contexts V • Abstract machine C
Example • Implicit analysis • Explicit analysis
Abstract Machine C • Explicit decomposition of a given expression • Uses a stack of frames instead of evaluation contexts. • Each frame corresponds to a specific step in the decomposition.
Outline • Evaluation contexts V • Abstract machine C V • Something important!
Midterm • Three hours, closed book • 20% toward your final grade • Next Wednesday, 8pm - 11pm, in the classroom April 2007 Su Mo Tu We Th Fr Sa 16 17 18 19 20 21 22 23 24 25 26 27 28