CSE-321 Programming Languages  -Calculus

# CSE-321 Programming Languages  -Calculus

Télécharger la présentation

## CSE-321 Programming Languages  -Calculus

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
##### Presentation Transcript

1. CSE-321 Programming Languages-Calculus 임현승 POSTECH March 26, 2009

2. : -reduction redex = reducible expression Values and Reductions

3. Call-by-name Call-by-value

4. Call-by-name Call-by-value

5. [e' / x] e • Informally"substitute e' for every occurrence of x in e." • Examples

6. Easy Cases First

7. Two Remaining Cases

8. First (stupid) attempt • Second attempt • But wait:

9. Bound Variables • Names of bound variables do not matter. • Hence • for a fresh variable y,

10. One Remaining Case

11. A Naive Attempt • An anomaly: something for y

12. Free Variables • Variables that are bound nowhere FV(e) = set of free variables in e

13. ? Free Variables Remain Free • From the point of view of an outside observer,a free variable remains free until it is explicitly replaced. variable capture outside observer

14. Capture-Avoiding Substitution • What happens if • the free variable y is captured and becomes a bound variable. • To an outside observer, it suddenly disappears!

15. Substitution Completed

16. Capture-Avoiding Substitution in Action • We have to rename bound variables as necessary.

17. -Conversion • Renaming bound variables when necessary • Okay because the names of bound variables do not matter. • Examples

18. Formalization of -Conversion • See the course notes! • It's more interesting than you might think.

19. Announcement • Assignment #4 is out tonight. • Implementing the call-by-value -calculus • Due in 2 weeks.