CSE-321 Programming Languages Continuation - PowerPoint PPT Presentation

About This Presentation
Title:

CSE-321 Programming Languages Continuation

Description:

'Precious~' Too powerful. turns you invisible! gives you an unusually long and active life! ... can simulate all control constructs. for, while, repeat/until ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 26
Provided by: sungwo8
Category:

less

Transcript and Presenter's Notes

Title: CSE-321 Programming Languages Continuation


1
CSE-321 Programming LanguagesContinuation
???
  • POSTECH
  • May 9, 2007

2
Commonalities?
goto
  • Too powerful
  • Too dangerous

3
"Precious"
  • Too powerful
  • turns you invisible!
  • gives you an unusually long and active life!
  • Too dangerous
  • turns you into an evil creature!
  • will eventually enslave you!

4
goto
  • Too powerful
  • can simulate all control constructs
  • for, while, repeat/until
  • switch
  • Too dangerous
  • damages code readability

5
Continuation goto of SML
  • Too powerful
  • code optimization
  • simple, elegant implementation of concurrency
  • compilation technique
  • CPS transformation used in SML/NJ
  • Too dangerous
  • damages code readability

6
Outline
  • Introduction V
  • Motivating example
  • Evaluation contexts
  • Continuations

7
Multiplying a List of Integers
8
An Improvement
9
Non-local Jump
10
Outline
  • Introduction V
  • Motivating example V
  • Evaluation contexts
  • Continuations

11
Evaluation Contexts
  • An evaluation context
  • an expression with a hole
  • "Give me an expression of type A"
  • "Then I will return an expression of type B"

12
Typing Evaluation Contexts
13
What are Continuations?
  • ?
  • Give me an expression of type A.
  • Then I will return an expression of type C.

? is a continuation!
14
Where is a continuation?
15
Outline
  • Introduction V
  • Motivating example V
  • Evaluation contexts V
  • Continuations

16
Simply Typed ?-Calculus
17
Reduction Rules
18
First-class Continuations
19
Exercises
20
Makes Sense?
21
Typing Continuations
22
(No Transcript)
23
See the Course Notes for an answer.
24
(No Transcript)
25
How do we return x?
How can we pass x to the outside of throw?
26
Answer Throw!
27
Big Announcement!
28
Special Assignment
  • Credit
  • unknown
  • Deadline midnight May 29 (Tuesday)
  • no extension
  • Where
  • handin directory cs321/handin/hw_photo/
  • What
  • JPEG picture of YOU with a big smile -)
  • size 200 by 260
  • name me.jpg
  • case-sensitive
Write a Comment
User Comments (0)
About PowerShow.com