CSE321 Programming Languages Evaluation Contexts and Abstract Machine
CSE-321 Programming Languages Evaluation Contexts and Abstract Machine C 박성우 POSTECH April 12, 2006
Simply Typed -Calculus 2
18 Reduction Rules 3
Simpler? 4
Outline • Evaluation contexts • Abstract machine C 5
Reduction Rules 6
Derivation Trees 7
Reducing an expression e • Locate an appropriate subexpression • Apply a corresponding reduction rule 8
Locate and Apply 9
Decompose and Apply = + 10
Decompose and Apply Expression = Subexpression to be reduced + Context to remain intact 11
Evaluation Contexts (CBV) • An expression with a hole ¤ in it • The hole ¤ indicates the position of a subexpression to be reduced. 12
Reduction Strategy • Determined by the definition of evaluation contexts call-by-value call-by-name 13
14
Reduction Rule 15
Still Cryptic? 16
Outline • Evaluation contexts V • Abstract machine C 17
This Rule is a Sagi. 18
Example 19
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. 20
State of the Machine 21
Example 22
23
Outline • Evaluation contexts V • Abstract machine C V • Something VERY important! 24
Midterm • One and half hours • Midterm 10% $ 15%, final 20% $ 25+% Su 9 16 23 30 Mo 10 17 24 April Tu We 11 12 18 19 25 26 2006 Th Fr 13 14 20 21 27 28 Sa 15 22 29 25
- Slides: 25