From Modern Compiler Implementation in ML, let function g(x: int) : - - PDF document

from modern compiler implementation in ml
SMART_READER_LITE
LIVE PREVIEW

From Modern Compiler Implementation in ML, let function g(x: int) : - - PDF document

1998 Andrew W. Appel From Modern Compiler Implementation in ML, let function g(x: int) : int = f(f(x)) var addTwentyFour := twice(twice(add(6))) let


slide-1
SLIDE 1
  • ✁✄✂
☎ ✆ ✝ ✞✠✟ ☎ ✡ ☛ ☞✍✌ ✟ ✎ ✌ ✡ ✏

let type intfun = int -> int function add(n: int) : intfun = let function h(m: int) : int = n+m in h end var addFive : intfun := add(5) var addSeven : intfun := add(7) var twenty := addFive(15) var twentyTwo := addSeven(15) function twice(f: intfun) : intfun = let function g(x: int) : int = f(f(x)) in g end var addTen : intfun := twice(addFive) var seventeen := twice(add(5))(7) var addTwentyFour := twice(twice(add(6))) in addTwentyFour(seventeen) end PROGRAM 15.1. A Fun-Tiger program. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

✑ ✒✔✓✖✕✘✗✚✙✜✛✢✕ ✣ ✤✦✥✚✧✄★✩✥✫✪✭✬✫★✩✪✯✮✱✰✳✲✵✴✷✶✹✸✻✺✭✬✼✶✽✥✫✮✱✰✾✶✿✮❁❀✚❂❃✬✫✥✻❄✔✶✿✴❅✺✭✥✫✰❇❆❈✰❉✬✫❄❊✸❋★✩✰✢●■❍❑❏▲✶✹✸✻✮◆▼✿✬✻✥▲❖P✶✿✴❅◗❘✮ ▼✿✮✱❙✻▼❉✮❁✰❉✮❁✥❚✶❊★❯✶✿✴❅✺✭✥❱✺✭❂✘★❘❂❃✬✫✥✻❄✔✶✿✴❅✺✭✥❳❲✩★✩✧❅✬✫✮❨❄❩★✩✥❱❬❭✮❪✶✹✸✻✮❫★✭❀✻❀✼▼✿✮❁✰❉✰■✺✭❂❴✶✿✸✻✮ ◗❵★✩❄❊✸✫✴❅✥✻✮❫❄❁✺❛❀✻✮❨❂❜✺✩▼■✶✿✸❝★❯✶✽❂❃✬✫✥✻❄✔✶✿✴❅✺✯✥❡❞ ✣ ❢❣✸✻✮❁✥✐❤❦❥❊❧❑♠♥❥✿♦✢♣❊qr❤❭s❁♠❈tP✉✈❤✻❧✇❄❁✺✭◗①✮❫✴②✥③✶✿✺④✶✹✸✻✮❨❙✫✴❅❄❑✶✹✬✼▼✿✮✭❏✻❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥✫✰■★✩▼❉✮ ▼✿✮✱❙✻▼❉✮❁✰❉✮❁✥❚✶✹✮✱❀✚★✭✰ s✱⑤❅✉⑥❧❊qr⑦✹❥⑧❧ ⑨✜▼✿✮✱❄❁✺✩▼✿❀✻✰✳✶✿✸✫★✈✶✽❄❁✺✭✥❚✶❊★✩✴❅✥⑩✶✹✸✻✮ ◗❵★✩❄❊✸✫✴❅✥✻✮❑❖♥❄❁✺❛❀✻✮ ❙❭✺✭✴❅✥❚✶✹✮✔▼ ★✩✥✫❀❱★✖✲✳★❁❶❷✶✹✺①★✩❄❁❄✱✮❁✰❉✰❸✶✹✸✻✮❫✥✻✮❁❄❁✮✱✰✿✰✿★✈▼✾❶❷✥✫✺✭✥r❖♥✧❅✺r❄❁★✭✧❭❲✩★✩▼❉✴✄★✩❬✫✧②✮❁✰ ❆ ❥⑧❤✫❹❺t❜⑦❉✉✈❤❝❻❼❥❑❤❽♠ ❍⑧❞ ✣ ❾❿✥✫✮❪✲❸★❁❶❳✺✯❂❴▼✿✮❁❙✼▼❉✮❁✰❉✮❁✥❚✶✹✴❅✥✻✪❘✮✱✥③❲▲✴②▼❉✺✯✥✻◗❘✮❁✥❚✶✹✰✵✴❅✰✵✬✫✰❉✴❅✥✻✪④✶✹✸✻✮ ❧❑♠♥➀✩♠❈tPs✖⑤➁t❜❤✻➂ ❞ ➃❘➄❅➅⑧➆③➇➉➈❚➆r➊r➋❑➆❚➌▲➍✈➅❺➎❴➏➑➐✜➐➓➒❩➔⑥→❊➣↔➒❨↕✾➙❚➒❺➏✷➛➝➜❺➞❭➟r➜⑥➏②➛⑥➐✦→❊➠↔➡✯→❊➠➢→❊➞✍→✹➠✦→❊➛❚↕✹→⑧➣✜➐➓➜❨➒❺↕❊↕✹→❊➣➓➣➤➐➓➙✯→ ➜⑥➥✭➐➓→✹➠➓➦◆➜⑥➣♥➐✜➧❁➒❺➠✦➏✷➒❩➨③➩➑→⑧➣➫➒⑥➛✯➡➝➐➓➙✯→✵➭⑥➒❩➠➢➨③➒❩➭⑥→✳↕✹➜⑥➩✷➩✷→❊↕✿➐➓➜❺➠➤➨r→⑧↕✹➜⑥➦◆→⑧➣➫➩➑→⑧➣✦➣✜→✹➯✼→⑧↕✿➐➓➏➲➧⑥→❺➳
slide-2
SLIDE 2
  • ✛✂✁☎✄✝✆✟✞
✒❁✒✔✓✡✠☛✁✌☞✘✛✎✍ ✞ ✠✏☞✒✑✔✓☎✁✌☞✕✑✔✓✗✖ ✘ ✛✎✠✳✓➝✙✙✍ ✕ ✣ ✚■✸✻✮❫✬✫✰❉✮❨✰ ✶❊★❯✶✿✴❅❄✇✧❅✴❅✥✜✛❛✰✽✴❅✥❱❄❁✧❅✺✭✰❉✬✼▼✿✮❁✰✵◗❘✮❩★✩✥✫✰❸✶✿✸❝★❯✶✢★✩❄✔✶✿✴✷❲✩★❯✶✹✴②✺✯✥❱▼❉✮❁❄❁✺✩▼❉❀✫✰■❂❜✺✩▼ ✢ ✮❁✥✫❄✱✧❅✺✭✰✿✴②✥✫✪✤✣❘❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥✫✰■◗ ✬✫✰ ✶✽✥✻✺✈✶✢❬➉✮❨❀✫✮❁✰ ✶❉▼✿✺❩❶❚✮❁❀❳✬✫❙➉✺✯✥⑩✶✹✸✻✮❁✴②▼✳▼✿✮✔✶✿✬✼▼✿✥ ❬❭✮✱❄❩★✩✬✫✰❉✮❿✶✹✸✻✮✔❶⑩✰❉✮✱▼ ❲❚✮✇★✩✰✵✮❁✥③❲▲✴②▼❉✺✭✥✫◗❘✮❁✥❚✶✹✰■❂❜✺✩▼✵✺✩✶✿✸✫✮✔▼✵❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥✻✰❩❞ ✣ ✥r✺✻❏✼★✩❄✔✶✿✴✷❲✩★❯✶✹✴❅✺✭✥✚▼✿✮❁❄✱✺✩▼✿❀✻✰■★✈▼✿✮❨✰ ✶✿✺✭▼❉✮❁❀❳✺✭✥⑩✶✿✸✫✮◆✸✻✮❩★✩❙⑩✴❅✥✫✰ ✶✿✮❩★✩❀✚✺✭❂ ✶✿✸✻✮❨✰ ✶✹★✭❄✔✛➉❞ ✤♥✶✵✴❅✰✳✶✹✸✻✮❁✥✚✬✫❙⑩✶✿✺④✶✹✸✻✮❨✪✯★✩▼❉❬✫★✭✪✭✮✇❄✱✺✭✧❅✧❅✮❁❄✔✶✿✺✩▼■✶✿✺❘❀✫✮✔✶✿✮✱▼❉◗①✴②✥✫✮◆✶✿✸❝★❯✶✽✴✷✶✢✴②✰✽✰✿★✩❂❜✮ ✶✹✺④▼❉✮❁❄❁✧✄★✩✴❅◗ ✶✿✸✫✮❫✸✻✮❩★✩❙▲❖➢★✩✧❅✧❅✺❛❄❩★❯✶✿✮❁❀❱❂✠▼✹★✩◗❘✮❁✰❁❞ ✣ ✦ ▼✿✮★✧❝✥✻✮❁◗❘✮❁✥❚✶✵✺✭❂ ✶✹✸✻✴❅✰✳✶✹✮✱❄⑧✸✻✥✫✴✪✩❛✬✫✮❨✴②✰■✶✿✺①✰✹★❁❲❚✮❫✺✭✥⑩✶✹✸✻✮❫✸✫✮❁★✭❙❳✺✯✥✻✧✷❶ ❲✩★✈▼✿✴✄★✩❬✻✧❅✮❁✰■✶✿✸❝★❯✶ ❥❊❧✱s✹➀✬✫✻❥ ❆ ★✈▼❉✮❫✬✫✰❉✮❁❀❳❬③❶⑩✴❅✥✫✥✻✮✱▼➓❖♥✥✫✮❁✰ ✶✿✮❁❀❱❂❃✬✫✥✻❄✔✶✿✴❅✺✯✥✻✰❊❍❑❞✭✥③✶✹★✭❄✔✛ ❂❃▼✿★✭◗❘✮❁✰❸✶✹✸❛✬✻✰✽★✩✧❅✰❉✺①✸✫✺✭✧❅❀❋★❘❙❭✺✭✴❅✥❚✶✹✮✔▼✳✶✹✺④✶✿✸✫✮ ✮✱✰✿❄❁★✭❙✻✴❅✥✻✪❯❖ ❲✩★✈▼❉✴✄★✩❬✫✧❅✮❫▼✿✮✱❄❁✺✩▼✿❀ ⑨ ✮ ➳✳➙✯➒⑥➣↔➒❺➛✰✯✖➩➑➜✩↕❊➒❺➩✼➧❁➒❩➠✦➏②➒❩➨③➩➑→⑧➣✘➐➓➙❚➒❁➐ ➒❺➛④➏✷➛❚➛✯→❊➠✲✱ ➛✯→⑧➣♥➐✦→⑧➡✖➟❚➠➢➜✭↕✹→❊➡❚➥✯➠➢→✽➦❨➏➑➭⑥➙❯➐↔➛✯→❊→⑧➡✴✳ ✵ ➳✳➒❿➣♥➐ ➒❁➐➓➏✷↕❸➩✷➏✷➛✯➔❨➐✦➜❿➐➓➙✯→❸→❊➛❯➧✭➏✷➠➢➜⑥➛❚➦◆→⑧➛⑥➐✜➟❚➠➢➜✔➧✯➏✷➡✯→❊➡ ➨✶✯✇➐ ➙✯→❸→❊➛❚↕❊➩➑➜⑥➣✦➏②➛✭➭❿➞✠➥❚➛✯↕✿➐➓➏✷➜⑥➛✻➳ ✷ ✗❱✙✜✛ ✸✚✗✹✖✺✠✻☞✕✑✔✓✗✖✼✁➝✒ ✷ ✙➫✓✾✽➝✙✒✁✾✿ ✿ ✑❀✖✺✽ ✦✢✧❅✧❅✺❩✲✽✰④❥❂❁❑q✫➀✭♠❈tP✉✈❤❭➀✭⑤ ⑦✹❥✿➀⑥❧✱✉✈❤✫t❜❤❄❃❷❬③❶⑩❙✻▼❉✺✭✸✫✴②❬✫✴✷✶✿✴❅✥✫✪❵✰❉✴❅❀✻✮❑❖♥✮❀❅❭✮✱❄✔✶✿✰✵✺✭❂ ❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥✻✰❩⑨ ✮ ➳❇❆ ➣✦➣✦➏➑➭⑥➛❚➦◆→⑧➛❯➐➓➣➤➐✦➜◆➧❁➒❩➠✦➏✷➒❺➨❚➩✷→❊➣❉❈✠→❂❊✯↕✹→❊➟✭➐ ➒❺➣➫➏✷➛❚➏➲➐ ➏✷➒❺➩✷➏●❋⑧➒❁➐ ➏➑➜⑥➛❚➣■❍ ✵ ➳❇❆ ➣✦➣✦➏➑➭⑥➛❚➦◆→⑧➛❯➐➓➣➤➐✦➜❑❏❚→⑧➩✷➡❚➣➫➜❺➞ ➙✯→❊➒❺➟▲✱ ➒❺➩②➩➑➜✩↕❊➒❁➐➓→❊➡ ➠✦→⑧↕✿➜❺➠➓➡❚➣ ▼ ➳❉◆✘➒⑥➩✷➩✷➣✘➐➓➜◆→❂❊✩➐✦→❊➠➓➛✯➒⑥➩✫➞✍➥❚➛❚↕✿➐➓➏➑➜⑥➛❚➣✜➐➓➙❚➒❁➐ ➙✯➒❑➧❯→ ➧✯➏✷➣✦➏➑➨③➩✷→❸➣➓➏✷➡✯→❖✱ →✹➯✼→⑧↕✿➐➓➣P❈✠➠✦→❊➒⑥➡✴◗③➟✯➠➓➏✷➛❯➐✔◗ →❂❊✯➏➑➐✔◗✜❘✔❘✔❘❙❍✾➳ ✚✳✸r✬✻✰❁❏✻❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥✫✰❸▼✿✮❑✶✹✬✼▼✿✥❳▼✿✮✱✰✿✬✻✧✷✶✹✰✌❚✜t ♠❱❯▲✉✈q✼♠❸s★❯r➀✈❤❄❃✈t❜❤❲❃ ♠❱❯✼❥❨❳❩❚ ✉❯⑦✱⑤②♦❭❬❫✴❅✥❋★✩✥③❶ ✺✭❬✻✰✿✮✔▼✾❲✩★✩❬✻✧❅✮◆✲✳★❁❶❫❪➫✤✦✥✻✰ ✶✹✮❩★✩❀✚✺✭❂✘✬✻❙❭❀✫★❯✶✹✴②✥✫✪❘✺✭✧❅❀✚❲✩★✩✧❅✬✻✮❁✰❁❏✻❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥✫✰✵★✩✧✷✲✳★❁❶▲✰ ❙✼▼✿✺❛❀✻✬✫❄✱✮❫✥✻✮✔✲❣❲✩★✭✧❅✬✻✮❁✰❁❞➫✤❵❴✯❾ ✴❅✰✵❙❭✮✔▼✿❂❜✺✩▼❉◗①✮✱❀❱✴❅✥❱★ s✹✉❯❤➉♠❈t❜❤✫q✫➀✭♠❈tP✉✈❤✟❛❵❜✿➀❯❧❁❥✿♦ ✰ ✶➢❶✼✧❅✮ ❈❃➏✷➛❯➐✦→❊➠➢→⑧➣♥➐➓➏②➛✭➭❯➩❝✯✇→⑧➛✯➜⑥➥✯➭⑥➙✜◗❡❞❣❢✐❤ ➨r→⑧↕✹➜⑥➦◆→⑧➣➫➛✯➜★❥ ❦ ➧✭➏②➣✦➏➑➨③➩➑→✬❧✽➐➓➜◆➐➓➙✯→❸➐♠✯✭➟r→❂✱ ↕✾➙✯→⑧↕ ➔❺→❊➠■❍ ❞
slide-3
SLIDE 3

type key = string type binding = int type tree = {key: key, binding: binding, left: tree, right: tree} function look(t: tree, k: key) : binding = if k < t.key then look(t.left,k) else if k > t.key then look(t.right,k) else t.binding function enter(t: tree, k: key, b: binding) = if k < t.key then if t.left=nil then t.left := tree{key=k, binding=b, left=nil, right=nil} else enter(t.left,k,b) else if k > t.key then if t.right=nil then t.right := tree{key=k, binding=b, left=nil, right=nil} else enter(t.right,k,b) else t.binding := b (a) Imperative type key = string type binding = int type tree = {key: key, binding: binding, left: tree, right: tree} function look(t: tree, k: key) : binding = if k < t.key then look(t.left,k) else if k > t.key then look(t.right,k) else t.binding function enter(t: tree, k: key, b: binding) : tree = if k < t.key then tree{key=t.key, binding=t.binding, left=enter(t.left,k,b), right=t.right} else if k > t.key then tree{key=t.key, binding=t.binding, left=t.left, right=enter(t.right,k,b)} else tree{key=t.key, binding=b, left=t.left, right=t.right} (b) Functional PROGRAM 15.3. Binary search trees implemented in two ways. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

✂✁☎✄✝✆✟✞✡✠☞☛✍✌✏✎✍✑✍☛✍✒✔✓✖✕✘✗✙☛✍✞✛✚✜✗✣✢✥✤✦✗✙☛✧✓✖✕★☛✩✑✪✠✫✓✖✕✘✗✣☛☎✬✮✭✯✠✰✞✱✆✟✌✳✲✵✴✣✶

type answer type stringConsumer = string -> answer type cont = () -> answer function getchar(c: stringConsumer) : answer function print(s: string, c: cont) : answer function flush(c: cont) : answer function exit() : answer

PROGRAM 15.4. Built-in types and functions for PureFun-Tiger. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

slide-4
SLIDE 4 ✂✁ ✄☎ ✁ ✆ ✝ ✞ ✟ ✠ ✡ ☛ ✄ ☞ ✠ ✟ ☞ ✌ ✆ ✠ ✟ ✄ ☞✎✍ ✏ ✆✑✒ ✓ ✔ ✕ ✖

let type intConsumer = int -> answer function isDigit(s : string) : int =

  • rd(s)>=ord("0") & ord(s)<=ord("9")

function getInt(done: intConsumer) = let function nextDigit(accum: int) = let function eatChar(dig: string) = if isDigit(dig) then nextDigit(accum*10+ord(dig)) else done(accum) in getchar(eatChar) end in nextDigit(0) end function putInt(i: int, c: cont) = if i=0 then c() else let var rest := i/10 var dig := i - rest * 10 function doDigit() = print(chr(dig), c) in putInt(rest, doDigit) end function factorial(i: int) : int = if i=0 then 1 else i * factorial(i-1) function loop(i) = if i > 12 then exit() else let function next() = getInt(loop) in putInt(factorial(i), next) end in getInt(loop) end PROGRAM 15.5. PureFun-Tiger program to read i, print i!. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

✗✙✘✛✚✢✜✤✣ ✜✦✥★✧✩✚✪✜✦✫✭✬ ✫✯✮✱✰✳✲✛✴✶✵ ✷✸✲✹✬✹✺✻✚✪✜✦✫✭✬✼✧✾✽❀✿❁✧✾✬❃❂✭✲✛✧❄❂✾✵❆❅ ✣ ✤✦✥✚✪✭✮❁✥✻✮✱▼✹★✩✧ ❏✻❂❃✬✫✥✻❄✔✶✿✴❅✺✯✥✫★✩✧❡✧✄★✩✥✫✪✭✬✫★✩✪✭✮❁✰✵❄❁★✩✥❱✬✫✰❉✮❪✶✿✸✫✮❫✰✿★✩◗❘✮ ✛r✴❅✥✻❀✻✰✽✺✭❂ ✺✭❙✼✶✿✴❅◗❘✴❈❇❩★❯✶✹✴❅✺✭✥✻✰✢★✩✰✽✴❅◗❘❙❭✮✔▼✹★❯✶✿✴✷❲❚✮✇✧✄★✩✥✫✪✭✬✫★✩✪✯✮❫❄❁✺✭◗❘❙✫✴❅✧❅✮✔▼✿✰✽★✩✥✫❀✚◗①✺✩▼❉✮✯⑨ ❉❋❊❍●■❊❑❏▼▲❖◆◗P ❉❋❊❍●✳❘✪❏▼▲❖◆❚❙ ❉❋❊❍●❚● ▲❖◆❯●❲❱❨❳❍❩❍●❭❬❫❪❍❊ ▲❖◆◗❊❑❏✶❴❵❘ ▲❖◆❛❘✪❏❍❜ ❉❋❊❍●◗❝ ▲❖◆❡❞❣❢❤●❥✐ ❉❋❊❍●❚❦ ▲❖◆❯●♠❧❤❊❯♥✳●♠❧♦❘ ♣ ❉❋❊❍●❡❦ ▲❖◆q❏sr ✣ ❾❿✥❳✶✿✸✫✮❨✺✈✶✿✸✫✮✔▼✵✸✫★✭✥✻❀ ❏✼✴❅✥❋✸✻✴❅✪✭✸✫✮✔▼ ❖♥✺✩▼✿❀✻✮✱▼✵❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥❝★✩✧ ✧✄★✩✥✻✪✯✬✫★✩✪✭✮❁✰❁❏ ❄❩★✩✧❅❄❁✬✻✧✄★❯✶✹✴❅✥✻✪④✶✹✸✻✮❫❄❁✺✭✥❚✶✿▼❉✺✭✧➑❖❤t❝✺❩✲ ✪✩▼✹★✩❙✻✸❱❄❩★✩✥✚❬❭✮❫★❘❬✫✴✷✶✵◗①✺✩▼❉✮✇❄❁✺✭◗❘❙✫✧②✴❅❄❩★❯✶✹✮✱❀ ❏ ❬❭✮✱❄❩★✩✬✫✰❉✮❿✶✹✸✻✮❨❄❁✺✭✥❚✶✿▼❉✺✯✧★t❝✺❩✲ ◗❵★❁❶❳❬❭✮❫✮✈✉✻❙✼▼✿✮✱✰✿✰❉✮✱❀❷✶✹✸✼▼✿✺✭✬✻✪✯✸✚❄❩★✩✧❅✧❅✰■✶✿✺ ❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥▲❖P❲✩★✈▼❉✴✄★✩❬✫✧❅✮❁✰✵✴❅✥✻✰ ✶✹✮❩★✩❀✚✺✭❂✘✰ ✶✹★❯✶✹✴❅❄❁★✭✧❅✧➑❶❱❀✫✮❀✧✫✥✻✮❁❀❳❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥✻✰❩❞
slide-5
SLIDE 5
  • ✖❋✒
✑ ✖✚✛ ✁✄✂✝✄✹✁✾✖❱✕ ✑✔✓✗✖ ☎ ✬✻✥✫❄❑✶✹✴❅✺✭✥✫★✩✧❡❙✻▼❉✺✭✪✭▼✿★✩◗①✰✳✶✿✮❁✥✻❀⑩✶✹✺①✬✻✰❉✮❫◗①★✩✥❚❶✚✰❉◗①★✩✧❅✧ ❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥✻✰❸✶✿✸❝★❯✶✽✪✭✮❑✶ ❙✫★✩✰✿✰❉✮❁❀❳❂❃▼✿✺✭◗ ✺✭✥✫✮❫❙✻✧✄★✩❄❁✮◆✶✿✺①★✭✥✻✺✈✶✹✸✻✮✱▼❁❞ ✦✢✥❱✴❅◗❘❙❭✺✩▼ ✶❊★✩✥❚✶❿✺✭❙▲✶✹✴❅◗❘✴❈❇❩★❯✶✿✴❅✺✭✥✚✶✹✮❁❄❊✸✫✥✻✴✪✩❛✬✫✮❨✴❅✰ t❜❤❽⑤➁t❜❤ ❥➝❥✝✆ ✫✼➀✈❤✻❧❊tP✉✈❤ ✺✯❂ ❂❃✬✫✥✻❄✔✶✿✴❅✺✯✥ ❄❁★✭✧②✧❅✰❩⑨✜▼❉✮❁❙✫✧✄★✩❄✱✴❅✥✫✪❵★❘❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥✚❄❩★✩✧❅✧❦✲✽✴✷✶✿✸ ★❘❄❁✺✭❙❚❶⑩✺✭❂❴✶✿✸✫✮❨❂❜✬✻✥✻❄✔✶✹✴②✺✯✥✚❬❭✺❛❀✼❶❚❞ ✣ ✞❿✺❩✲ ✶✿✺❘❙❭✮✱▼❉❂❜✺✩▼✿◗ ✴❅✥✻✧❅✴❅✥✻✴❅✥✫✪✠✟ ✣ ❢❣✸✻✮❁✥⑩✶✿✺❘❙❭✮✱▼❉❂❜✺✩▼✿◗ ✴❅✥✻✧❅✴❅✥✻✴❅✥✫✪ ★✩✥✻❀⑩✲✽✸✻✮❁✥✚✥✫✺✈✶■✶✿✺✡✟ ☛ ✒ ☞ ✒ ✁ ✟✌☞ ✍ ✁ ✄☎ ✁ ✆ ✝ ✠ ✄ ✍ ✁ ✟ ☞ ✠ ✆ ☞ ✟ ☞ ✠ ✠ ✆ ✎✏ ✒

let type list = {head: int, tail: list} type observeInt = (int,cont) -> answer function doList(f: observeInt, l: list, c: cont) = if l=nil then c() else let function doRest() = doList(f, l.tail, c) in f(l.head, doRest) end function double(j: int) : int = j+j function printDouble(i: int, c: cont) = let function again() = putInt(double(i),c) in putInt(i, again) end function printTable(l: list, c: cont) = doList(printDouble, l, c) var mylist := ··· in printTable(mylist, exit) end PROGRAM 15.6. printTable in PureFun-Tiger. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

slide-6
SLIDE 6
✄☎ ✁ ✆ ✝ ✎ ✒
✁ ✒ ✆ ☞ ✓ ✆
✒ ✁ ✔ ☞ ✏ ✟ ☞ ✟ ☞ ☎

let type list = {head: int, tail: list} function double(j: int): int = j+j function printDouble(i: int) = (putInt(i); putInt(double(i))) function printTable(l: list) = while l <> nil do (printDouble(l.head); l := l.tail) var mylist := ··· in printTable(mylist) end (a) As written let type list = {head: int, tail:list} function printTable(l: list) = while l <> nil do let var i := l.head in putInt(i); putInt(i+i); l := l.tail end var mylist := ··· in printTable(mylist) end (b) Optimized PROGRAM 15.7. Regular Tiger printTable. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

✞ ✓④✓✗✑❀✍ ✑ ✖✼✽ ✁ ✁✇✙✭✑ ✁✄✂ ✒✔✛ ✑ ✁ ✄✼☞➤✗❱✙✜✛ ☎ ✺❛❄❩★✩✧❭❲✩★✈▼✿✴✄★✩❬✻✧❅✮❁✰✽❄❩★✩✥❱❄✔▼✿✮❩★❯✶✿✮ ✢ ✸✫✺✭✧❅✮❁✰❖✣①✴❅✥❳✶✹✸✻✮❨✰✿❄✱✺✭❙❭✮❨✺✭❂ ✺✭✬✼✶✿✮✱▼✳❲✩★✩▼❉✴✄★✩❬✫✧❅✮✱✰❁❞ ☎ ✺✩▼✵❄❁✺✩▼❉▼❉✮❁❄✔✶✿✥✻✮❁✰❉✰❩❏✼✴❅✥✻✧❅✴❅✥✻✴❅✥✫✪❵✰❉✸✻✺✯✬✻✧❅❀✼✧✫▼❉✰ ✶✵▼✿✮✱✥❝★✩◗❘✮❼❆ ✆ ❛ s✹✉❯❤❝❹✩❥⑧⑦✱♠ ❍ ✶✿✸✫✮❨❂❜✺✩▼✿◗①★✩✧ ❙✫★✈▼✹★✩◗❘✮✔✶✿✮✱▼✿✰■✺✭❂ ✴❅✥✫✥✻✮✱▼➓❖♥✥✫✮✱✰✾✶✿✮❁❀✚❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥✫✰❁❞ ✝ ❱✟✞❚❉❋❊❍●❚❝ ▲ ◆❚P ✝ ❱✟✞❡❉❋❊❍●◗❝ ▲❖◆◗P ❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛✑✏ ❢❤❦♠▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆ ❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛✑✏ ❢❤❦♠▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆ ❦❡♥❡❝ ❦❚♥❡❝ ❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛ ❞❣❢ ❝ ▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆ ♣ ❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛ ❞❣❢ ❊ ▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆ ✏ ❢ ❏ ✐ ♥❡❝ ❢ ❏ ♥❡❝❑✐ ♥ ❊ ✍✓☛✙❞❣❢ r❨✐ ♥❡❝ ✍✓☛■❞❣❢ r❨✐ ♥❡❝ ❱✖☛❨❬ ❱✖☛❨❬
slide-7
SLIDE 7 ✔ ☞ ✏ ✟ ☞ ✒ ✂✁ ✍ ✆ ☞ ✑ ✟ ✄ ☞ ✄ ☎ ✄ ✄ ✍ ✂✁ ✒ ✡ ✒ ✆ ✓ ✒ ✁

(a) When the actual parameters are simple variables i1, . . . ,in. Within the scope of: function f (a1, . . . , an) = B the expression f (i1, . . . ,in) rewrites to B[a1 → i1, . . . , an → in] (b) When the actual parameters are non- trivial expressions, not just variables. Within the scope of: function f (a1, . . . , an) = B the expression f (E1, . . . , En) rewrites to let var i1 := E1 . . . var in := En in B[a1 → i1, . . . , an → in] end where i1, . . . ,in are previously unused names.

ALGORITHM 15.8. Inline expansion of function bodies. We assume that no two declarations declare the same name. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

function f (a1, . . . , an) = B → function f (a′

1, . . . , a′ n) =

let function f ′(a1, . . . , an) = B[ f → f ′] in f ′(a′

1, . . . , a′ n)

end

ALGORITHM 15.9. Loop-preheader transformation. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

✒❀✑ ✖✹✑ ✖✼✽ ✓✝✆ ✘ ✛ ✠■✗✚✙↔✕ ✑✔✓❘✛ ✸✚✗✹✖✹✠✏☞✒✑❑✓✗✖❋✕ ✚ ✺①★❁❲❚✺✭✴❅❀ ✮✈✉✻❙✫★✩✥✫✰❉✴❅✺✭✥✚✺✭❂✘✺✭✥✻✧✷❶❷✶✿✸✫✮❑✧✫▼❉✰✾✶✵❄❩★✩✧❅✧ ✶✿✺❵★④▼❉✮❁❄❁✬✼▼❉✰✿✴✷❲❚✮❫❂❜✬✻✥✻❄✔✶✹✴②✺✯✥ ❆❜✶✿✸✫✮ ✧✻▼✿✰ ✶✵✴✷✶✹✮✔▼✹★❯✶✹✴②✺✯✥❋✺✭❂✘★❘✧❅✺❛✺✯❙❽❍❸★ ⑤②✉❺✉✔✫ ❛ ✫❝⑦✹❥ ❯✼❥❉➀❚♦③❥⑧⑦ ♠❈⑦✿➀✈❤✻❧❜♣✱✉✈⑦⑧❻❼➀✭♠❈tP✉✈❤ ✴❅✰✽✬✻✰❉✮❁❀❡❞ ✚✳✸✫✮❫✴②❀✫✮❩★④✴❅✰✳✶✹✺①✰❉❙✻✧❅✴✷✶❿★❘❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥✚✴②✥③✶✿✺✻⑨ ✞ ★ ✫❝⑦✹❥✱⑤➁q✫♦③❥ ❄❩★✩✧❅✧❅✮❁❀❱❂❃▼✿✺✭◗ ✺✭✬✼✶✿✰❉✴❅❀✫✮❫✺✭✥✻❄❁✮✯❏✻★✩✥✻❀ ✞ ★ ⑤②✉❩✉✬✫ ❯✼❥✿➀❚♦③❥⑧⑦ ✲✽✸✻✴❅❄⑧✸❱✴②✰✵▼❉✮❁❄❁✬✼▼❉✰✿✴✷❲❚✮❁✧➑❶❱❄❁★✩✧❅✧❅✮❁❀❱❂✠▼✿✺✭◗ ✴❅✥✫✰❉✴❅❀✻✮ ✟✡✠☞☛✍✌✡✎✑✏✓✒✔☛ ✕✖✒✘✗✙✏☞✚✛✎ ✜✢✟✤✣✦✥✧✒✔★✩✚✓✪✓✫✭✬✖✪✖✮✯☛✰✎✲✱✴✳✘✣✦✥✢✳✰✏☞✚✛✎✲✱✵✌✡✣✶✥✢✌✤✒✛☛✰✎✩✷✹✸ ✳✤✪✘✎✺✟✡✠☞☛✍✌✔✎✍✏✓✒✔☛ ✕✖✒✘✗✙✏☞✚✛✎✰✣ ✜✢✟✦✥✧✒✔★✩✚✘✪✭✫✭✬✖✪✖✮✻☛✼✎✲✱✽✳✾✥✧✳✼✏✤✚✛✎✦✱✵✌✿✥✢✌✤✒✛☛✼✎✍✷✹✸ ✏✡✟✺✳✓✸✘☛✩✏✓✳❀✎✭❁✙✪✔☛❂✌❃✜✻✷ ✪☞✳✼✚✘✪❄✳✭✪✘✎✺✟✘✠✤☛✍✌✡✎✑✏✭✒✛☛❅✕✼✒✔❆✙✪✼✚✔✎✾✜❇✷❀✸ ✕✼✒✓✗✙✏✤✚✔✎☞✣ ✜✢✟❈✱✵✳❈❉❊✎✼❋✖✏✓✳●✱✽✌✰✷ ✏✯☛❅✟✿✜❍✳❈❉■❁✙✪✤❋✭✕✾✱❏✕✼✒✔❆✙✪✼✚✔✎✍✷ ✪✔☛✼✕ ✏❑☛ ✕✖✒✘✗✑✏✤✚✛✎✰✣ ✜▲✟✭✣✾✱✵✳✘✣✲✱▼✌✘✣✑✷ ✪✔☛✖✕
slide-8
SLIDE 8 ✿ ✫ ✫✯✘✁✄✂ ✬✆☎ ✧❄✴ ✜ ✧ ✬ ✚✞✝ ✫✭✜ ❅❑✚✢✜✤✬✼❂ ✟ ✴✢✧✾✬✛✮ ✫✯✴ ✣ ✧✩✚✪✜ ✫✭✬ ✠✈✵☛✡✼✧ ✣ ✘ ✽ ✵✌☞ ❢ ✮❨❄❁★✩✥❋★❁❲❚✺✭✴❅❀❋❙✫★✩✰✿✰❉✴❅✥✻✪❵★✩▼❉✺✭✬✫✥✻❀❳❲✩★✩✧❅✬✻✮❁✰✳✶✹✸✫★❯✶✢★✈▼❉✮◆✶✹✸✻✮❫✰✿★✭◗❘✮❫✴❅✥❱✮✔❲❚✮✱▼ ❶ ▼❉✮❁❄❁✬✼▼❉✰✿✴✷❲❚✮❫❄❁★✭✧②✧ ❆ →❩➳ ➭❚➳ ❞ ➒❺➛❚➡ ❳ ➏②➛ ❬❲❩✎✍✎✍✑✏✌✞✓✒ ❍✳❬❚❶⑩✬✫✰❉✴❅✥✻✪❼★ ⑤②✉❺✉✬✫❭❛♥t❜❤✫❹✈➀✈⑦⑧tP➀✈❤❽♠ ❯r✉✈t❃❧❑♠❈t❜❤❲❃ ✶❉▼✹★✩✥✻✰✿❂❜✺✩▼❉◗①★✈✶✿✴❅✺✭✥ ❆ ➠➢→❊➟③➩✷➒❺↕✹→✳→✿➧❯→✹➠❣✯➝➥❚➣➢→■➜❺➞ ❞ ❥ ➏➑➐➓➙ ❞✄✒ ➒⑥➛✯➡ ❳ ❥ ➏➲➐➓➙ ❳✔✒ ❍❑❞ ✟✡✠☞☛✍✌✡✎✑✏✓✒✔☛ ✕✖✒✘✗✙✏☞✚✛✎ ✜ ✟ ✥✧✒✛★ ✚✘✪✭✫✭✬✼✪✙✮✻☛✼✎✲✱✽✳✓✣✦✥✧✳✼✏✤✚✔✎✲✱ ✌ ✥✢✌✤✒✛☛✼✎✍✷❀✸ ✳✤✪✘✎✺✟✡✠☞☛✍✌✔✎✍✏✓✒✔☛ ✕✖✒✘✗✙✏☞✚✛✎✰✣ ✜ ✳✾✥✧✳✼✏✤✚✛✎✩✷❀✸ ✏✡✟✺✳✓✸✘☛✩✏✓✳❀✎✭❁✙✪✔☛❂✌❃✜✻✷ ✪☞✳✼✚✘✪❄✳✭✪✘✎✺✟✘✠✤☛✍✌✡✎✑✏✭✒✛☛❅✕✼✒✔❆✙✪✼✚✔✎✾✜❇✷❀✸ ✕✼✒✓✗✙✏✤✚✔✎☞✣ ✜ ✳❈❉❊✎✼❋✖✏✓✳✼✷ ✏✯☛❅✟✿✜❍✳❈❉■❁✙✪✤❋✭✕✾✱❏✕✼✒✔❆✙✪✼✚✔✎✍✷ ✪✔☛✼✕ ✏❑☛ ✕✖✒✘✗✑✏✤✚✛✎✰✣ ✜❍✳✘✣✑✷ ✪✔☛✖✕ ✕ ✟ ✟ ✖ ✗ ✘ ☎✙ ✡ ✌ ✞ ✡ ☎ ✝ ✚ ✟ ✞✜✛ ✝ ✞ ☎ ✎

If every use of f ′ within B is of the form f ′(E1,... , Ei−1,ai, Ei+1,..., En) such that the ith argument is always ai, then rewrite

function f (a′

1,... ,a′ n) =

let function f ′(a1,... ,an) = B in f ′(a′

1,... ,a′ n)

end

function f (a′

1,... ,a′ i−1,ai,a′ i+1,...,a′ n) =

let function f ′(a1,... ,an) = B in f ′(a′

1,... ,a′ i−1,a′ i+1,... ,a′ n)

end

where every call f ′(E1,... , Ei−1,ai, Ei+1,..., En) within B is rewritten as f ′(E1,... , Ei−1, Ei+1,..., En).

ALGORITHM 15.10. Loop-invariant hoisting. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel 1 function printTable(l: list, c: cont) = 2 let function doListX(l: list) = 3 if l=nil then c() 4 else let function doRest() = 5 doListX(l.tail) 6 var i := l.head 7 function again() = 8 putInt(i+i,doRest) 9 in putInt(i,again) 10 end 11 in doListX(l) 12 end PROGRAM 15.11. printTable as automatically specialized. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

slide-9
SLIDE 9 ✞ ✓④✓✗✑❀✍ ✑ ✖✼✽ ✑ ✓ ✍❱✛ ✁✄✂✝✄ ✒✔✓✖✕ ✑❑✓ ✖ ✤➢❂ ✴❅✥✻✧❅✴❅✥✫✮✇✮s✉✼❙❝★✩✥✻✰❉✴❅✺✯✥❳✴❅✰✽❙❭✮✱▼❉❂❜✺✩▼❉◗①✮❁❀❳✴❅✥✫❀✻✴❅✰❉❄✱▼❉✴❅◗①✴❅✥✫★✩✥❚✶✹✧✷❶③❏✻✶✿✸✫✮❫✰❉✴❈❇❁✮❨✺✯❂ ✶✿✸✻✮ ❙✼▼✿✺✭✪✩▼✿★✩◗ ✮✈✉✻❙✻✧❅✺❛❀✫✮✱✰ ❪ ✚✳✸✫✮✔▼✿✮✇★✈▼❉✮❫✰✿✮❑❲❚✮✱▼✹★✩✧❡✸✻✮❁✬✼▼✿✴❅✰ ✶✿✴❅❄❁✰✳✶✹✺❘❄❁✺✭✥❚✶✿▼❉✺✭✧❡❄❁✺❛❀✫✮❨✮✈✉✻❙✻✧❅✺✭✰❉✴❅✺✭✥ ⑨
  • ❞✂✁
✉✼❙❝★✩✥✻❀✚✺✭✥✫✧✷❶✖♣❊⑦✹❥❂❁❑q❝❥❑❤❽♠❸❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥r❖➢❄❁★✭✧②✧❡✰✿✴➑✶✹✮❁✰❇❆ ➞✄➠➢→☎✄✩➥✭→⑧➛❚↕❂✯✖↕❊➒❺➛✖➨r→ ➡✯→✹➐✦→❊➠✦➦❨➏✷➛✯→⑧➡❇→⑧➏➲➐ ➙✭→❊➠➤➨ ✯ ➣♥➐➓➒❩➐➓➏✷↕ →❊➣➢➐➓➏✷➦❨➒❁➐ ➏➑➜⑥➛✝✆ ➩➑➜✩➜❺➟✤✱ ➛✭→⑧➣♥➐➫➡✯→❊➟✭➐ ➙✟✞✫➜❺➠➤➨ ✯✇➞✍→❊→❊➡✯➨③➒❺↕✾➔ ➞✍➠➢➜⑥➦ ➒⑥➛➝→❂❊✭→⑧↕❊➥✭➐➓➏➑➜❯➛➝➟❚➠➢➜✐❏③➩✷→✹➠ ❍☎✠ ✡ ❞✂✁ ✉✼❙❝★✩✥✻❀✚✺✭✥✫✧✷❶❳❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥✻✰❑❚✜t ♠❱❯⑩❹✭❥⑧⑦☞☛①❧❊❻❼➀✭⑤❜⑤ ❜✿✉❩♦✈t ❥❊❧❷❆ ➣➢➜❪➐➓➙❚➒❁➐↔➐ ➙✯→■↕✹➜❺➟③➏➑→⑧➡ ➞✠➥❚➛✯↕✿➐➓➏✷➜⑥➛✖➨r➜✩➡✤✯✖➏✷➣↔➛✭➜❺➐ ➦❿➥✯↕❉➙④➩✷➒❩➠➢➭❺→❊➠✜➐➓➙❚➒❺➛➝➐ ➙✯→■➏✷➛❚➣♥➐➓➠✦➥❚↕❉➐ ➏➑➜⑥➛❚➣✜➐➓➙❚➒❁➐ ❥✘➜❯➥✯➩②➡✖↕✹➒❺➩②➩ ➐ ➙✭→■➞✍➥❚➛❚↕✿➐➓➏➑➜❯➛ ❍☞✠ ✌ ❞✂✁ ✉✼❙❝★✩✥✻❀✚❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥✫✰❇s✹➀✭⑤❜⑤❅❥✿♦⑩✉✈❤❽⑤✍☛⑩✉❯❤❦s❊❥ ★✩✥✻❀✚❙❭✮✔▼✿❂❜✺✩▼❉◗ ♦❚❥✿➀❚♦✽♣❊qr❤❦s✱♠❈tP✉✈❤ ❥✱⑤➁t❜❻④t❃❤❦➀✩♠ t ✉✈❤ ✶✿✺❘✶✿✸✻✮❨✺✭▼❉✴❅✪✭✴❅✥✫★✭✧ ❙✼▼✿✺✭✪✩▼✹★✩◗✚❞ ✑ ✒✔✓✖✕✘✗✚✙✜✛ ✑ ✓✗✖ ✓④✛✽✙↔✕ ✑❑✓✗✖ ✚✳✸✫✮✇★✩✴❅◗ ✴❅✰✳✶✿✺❱♠❈⑦✿➀✈❤✻❧❜♣✱✉✈⑦⑧❻ ♠❱❯✼❥P✫❽⑦✿✉❂❃✈⑦✿➀✈❻ ❧✱✉ ♠❱❯▲➀✭♠↔❤❦✉✵♣❊qr❤❭s❁♠❈tP✉✈❤ ★✩❙✻❙❭✮❁★✩▼❉✰❸✶✿✺ ➀✯s✹s❊❥⑧❧✹❧↔♣❊⑦✹❥✿❥✏✎P❤❭✉✈❤✟❛✦⑤②✉❩s✹➀✭⑤✒✑④❹✈➀✈⑦⑧tP➀❡❜✱⑤❅❥❊❧❑❞ ✚✳✸✫✴❅✰✵✴❅✰✵❀✫✺✭✥✻✮❫❬❚❶ ✶✿✬✻▼❉✥✫✴②✥✫✪①✮❩★✩❄⑧✸ ❂❃▼❉✮❁✮⑧❖ ❲✩★✈▼❉✴✄★✩❬✫✧❅✮❇★✩❄❁❄❁✮✱✰✿✰✳✴②✥③✶✿✺❼★④❂❜✺✭▼❉◗①★✩✧➑❖➢❙✫★✈▼✹★✩◗❘✮✔✶✿✮✱▼❿★✩❄❁❄❁✮✱✰✿✰ ⑨ ✓ ➏➲➧⑥→⑧➛✖➒◆➞✍➥❚➛❚↕✿➐➓➏➑➜⑥➛ ✔ ❈✖✕✘✗☎✙✔❘ ❘✔❘✚✙✛✕✢✜❲❍ ✣ ✤ ➒❁➐↔➛✯→⑧➣♥➐➓➏②➛✭➭❫➡✯→❊➟✯➐➓➙ ✥ ❥ ➏➑➐➓➙ →⑧➣✦↕❊➒❩➟③➏✷➛✯➭❨➩➑➜✭↕❊➒❺➩▲➧❁➒❺➠✦➏✷➒❩➨③➩➑→⑧➣☛❈❜➒❺➛❚➡✖➞✍➜❺➠✦➦❨➒⑥➩✼➟③➒❩➠✦➒⑥➦◆→✿➐➓→✹➠➓➣■❍ ✦✧✗☎✙★✦✪✩✫✙ ❘✔❘ ❘✬✙★✦✭✜ ➒❺➛❚➡④➛✯➜⑥➛✯→❊➣➓↕✹➒❺➟❚➏②➛✭➭❨➧❁➒❩➠✦➏✷➒❺➨❚➩✷→❊➣✯✮✰✗☞✙ ❘ ❘✔❘✬✙★✮✫✜✜◗③➠➢→ ❥↔➠➓➏➲➐✦→■➏✷➛❯➐✦➜❚➎ ✔ ❈ ✕✢✱ ✙✛✕✘✗☎✙✔❘ ❘✔❘✚✙✛✕✢✜ ❍ ✣ ✝ ❱✟✞❡❉❋❊❍● ✲ ➎✰✣ ❪ ✕✳✱ ✙★✦✴✗☞✙★✦✪✩✫✙ ❘ ❘✔❘✬✙★✦✭✜ ❜ ✍✓☛ ✤✶✵ ❱✖☛❨❬ ❥ ➙✯→❊➠➢→✳➐➓➙✯→✵➛✯→ ❥ ➟③➒❩➠✦➒⑥➦◆→✿➐➓→✹➠ ✕✳✱ ➏✷➣➤➐➓➙✯→✽➣♥➐➓➒❁➐➓➏②↕❸➩✷➏✷➛✯➔ ❥ ➙✯➏②↕✾➙④➏✷➣➫➛✯➜★❥ ➦❨➒❺➡✯→ ➏✷➛❯➐✦➜❨➒⑥➛➝→❂❊✯➟❚➩②➏✷↕❊➏➲➐➫➒❺➠➢➭⑥➥❚➦◆→⑧➛⑥➐✬◗③➒❺➛❚➡ ✲ ➏✷➣↔➒◆➠➢→⑧↕✿➜⑥➠✦➡④↕✿➜❯➛⑥➐➓➒⑥➏✷➛❚➏✷➛✯➭◆➒❺➩②➩✼➐➓➙✯→ →⑧➣✦↕❊➒❩➟③➏✷➛✯➭❪➧❁➒❩➠➓➏✷➒❩➨③➩➑→⑧➣✸✷✺✹✼✻❇➐➓➙✯→✵→❊➛❚↕❊➩➑➜⑥➣✦➏②➛✭➭❨➣♥➐➓➒❩➐➓➏✷↕❸➩✷➏✷➛✯➔▲➳ ❆ ➛✰✯✖➥✯➣✦→■➜❺➞❦➒❨➛✯➜⑥➛▲✱ ➩✷➜✩↕❊➒❺➩✼➧❩➒❩➠✦➏✷➒❩➨③➩✷→❑❈✠➐➓➙❚➒❁➐ ↕✹➜⑥➦◆→⑧➣✜➞✍➠➢➜⑥➦ ➛✯→⑧➣♥➐➓➏✷➛✯➭❨➡✯→❊➟✯➐➓➙ ✽ ✥ ❍ ❥ ➏➑➐➓➙❚➏✷➛ ✤ ➦❿➥❚➣♥➐↔➨r→■➐✦➠➓➒❺➛❚➣➢➞✄➜❺➠➓➦◆→⑧➡✖➏✷➛❯➐✦➜❫➒❺➛✖➒⑥↕✹↕✹→⑧➣✦➣✜➜❺➞❦➣➢➜⑥➦◆→✳➜❩➯✻➣➢→✹➐ ❥ ➏➑➐➓➙❚➏✷➛ ➐➓➙✯→■➠✦→❊↕✹➜❺➠➓➡ ✕ ✱ ➳✿✾➫➙✯→■➠➢→⑧➣✦➥❚➩➲➐ ➏✷➛✯➭◆➨r➜✭➡▲✯④➏✷➣ ✤ ✵ ➳
slide-10
SLIDE 10 ✂✁ ✄ ☎ ✁ ✆ ✝ ✆
✒ ✁ ☛ ✏ ✄ ✑ ✌ ✁ ✒ ☛ ✄ ☞
✁ ✑ ✟ ✄ ☞

type mainLink = { ··· } type printTableLink= {SL: mainLink, cFunc: cont, cSL: ?} type cont = ? -> answer type doListXLink1 = {SL: printTableLink, l: list} type doListXLink2 = {SL: doListXLink1, i: int, doRestFunc: cont, doRestSL: doListXLink1} function printTable(SL: mainLink, l: list, cFunc: cont, cSL: ?) = let var r1 := printTableLink{SL=SL,cFunc=cFunc,cSL=cSL} function doListX(SL: printTableLink, l: list) = let var r2 := doListXLink1{SL: printTableLink, l=l} in if r2.l=nil then SL.cFunc(SL.cSL) else let function doRest(SL: doListXLink1) = doListX(SL.SL, SL.l.tail) var i := r2.l.head var r3 := doListXLink2{SL=r2, i=i, doRestFunc=doRest, doRestSL=r2} function again(SL: doListXLink2) = putInt(SL.SL.SL, SL.i+SL.i, SL.doRest.func, SL.doRestSL) in putInt(SL.SL,i, again,r3) end in doListX(r1,l) end PROGRAM 15.12. printTable after closure conversion. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

✁✂✁ ✠❉✑✔✛ ✖✗☞ ✄ ✁ ✑❁✒❨✘ ✛✎✠✵✗✚✙➫✕ ✑✔✓✗✖ ✦ ❂❃✬✫✥✻❄✔✶✿✴❅✺✯✥✚❄❩★✩✧❅✧✆☎ ❆✞✝❦❍ ✲✽✴✷✶✿✸✻✴❅✥❱✶✿✸✻✮❫❬➉✺❛❀✼❶❷✺✯❂➤★④❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥✠✟❦❆☛✡▲❍✳✴②✰✽✴❅✥❋★➝✶❊★✩✴❅✧ ❙➉✺✭✰✿✴✷✶✿✴❅✺✭✥❳✴❅❂ ✢ ❄❩★✩✧❅✧❅✴❅✥✻✪☞☎✚✴❅✰ ✶✿✸✻✮❪✧✄★✩✰ ✶✳✶✹✸✻✴❅✥✻✪ ✶✹✸✫★❯✶✌✟❵✲✵✴❅✧❅✧ ❀✫✺➝❬❭✮❁❂❜✺✩▼❉✮❿▼❉✮✔✶✿✬✻▼❉✥✫✴❅✥✻✪✤✣✻❞ ✮ ➳ ✝ ❱✟✞❡❉❋❊❍●◗❝ ▲❖◆✎✍ ✗ ✍✓☛ ✤✂✗ ❱✡☛❨❬ ✵ ➳ ✍ ✗ ❈ ✍ ✩★❍ ▼ ➳ ✍ ❞✎✍ ✗ ✞✑✏❫❱✖☛ ✤✂✗ ❱ ✝ ✏ ❱ ✤ ✩ ✒ ➳ ✍ ✗✔✓ ✍ ✩ ✚✘★✩✴❅✧❡❄❩★✩✧❅✧❅✰✽❄❩★✩✥✚❬➉✮❫✴❅◗①❙✻✧❅✮❁◗❘✮❁✥❚✶✿✮❁❀❱◗❘✺✩▼✿✮❫✮✖✕①❄❁✴❅✮❁✥❚✶✹✧➑❶⑩✶✿✸❝★✩✥✚✺✭▼❉❀✻✴❅✥❝★✈▼ ❶✚❄❁★✭✧②✧❅✰ ❪ ✗✙✘✛✚✢✜ ✣ ✤✦✥★✧✪✩✬✫✮✭✪✯ ✰✱✣✳✲✴✘✵✚✶✜✂✷✹✸ ✺✻✘✛✯✢✜ ✥✼✸✾✽ ✾➫➙✯→✳➠✦→❊➣✦➥❚➩➑➐ ✲ ➠✦→✿➐ ➥✯➠✦➛✯→❊➡❘➞✄➠✦➜⑥➦ ❞❣❢ ❝❑✐ ❥ ➏✷➩✷➩✫➒❺➩✷➣➢➜◆➨r→✳➐ ➙✭→✵➜⑥➛✯→✳➠✦→✿➐ ➥✯➠✦➛✯→⑧➡✖➞✍➠➢➜⑥➦ ✏ ❢❤❦❥✐ ➳ ❞ ➛❚➣♥➐✦→⑧➒❺➡④➜❺➞➉➟③➥❚➣✦➙❚➏✷➛✯➭✇➒◆➛✯→ ❥ ➠➢→✹➐➓➥✯➠✦➛❘➒❺➡❚➡✭➠✦→❊➣➓➣➫➞✍➜❺➠ ❞ ➐➓➜❨➠➢→✹➐➓➥✯➠✦➛✖➐✦➜ ◗ ✏ ↕✹➜⑥➥❚➩✷➡❀✿♥➥❚➣♥➐ ➭⑥➏➲➧⑥→ ❞ ➐➓➙✯→■➠➢→✹➐➓➥✯➠✦➛①➒❺➡❚➡✭➠✦→❊➣➓➣➫➭⑥➏➲➧⑥→⑧➛ ➐✦➜ ✏ ➒❺➛❚➡❘➙✯➒❑➧❯→ ❞ ➠➢→✹➐ ➥✭➠➓➛❘➡❚➏➑➠➢→⑧↕✿➐➓➩❝✯⑥➳
slide-11
SLIDE 11 ✂ ✣ ✘ ✽✦✵✩✣ ✵✩✬ ✚ ✧ ✚✢✜✦✫✭✬ ✫✯✮ ✟ ✧✾✜✤✽✁ ✵ ✺★✲✛✴ ❅✶✜✦✫✭✬ ✗✙✘✛✚✢✜✤✣ ✜✦✥★✧ ✚✢✜✦✫✭✬ ✦ ✶✹★✩✴❅✧ ❄❩★✩✧❅✧❡❄❩★✩✥❱❬➉✮❨✴❅◗①❙✻✧❅✮❁◗❘✮❁✥❚✶✹✮✱❀❋◗❘✺✩▼✿✮❫✧❅✴✪✛✭✮ ★ ✂☎✄✝✆✟✞ ✶✿✸❝★✩✥❋★ ✠ ✫ ✤✦✤ ⑨
  • ❞☛✡
✺❩❲❚✮✇★✩❄✔✶✿✬❝★✩✧ ❙✫★✩▼✿★✩◗①✮❑✶✹✮✔▼✿✰✵✴❅✥❚✶✹✺❵★✈▼✿✪✭✬✻◗①✮✱✥③✶✵▼❉✮❁✪✭✴❅✰ ✶✹✮✱▼❉✰❁❞ ✡ ❞☛☞✽✮❁✰ ✶✹✺✩▼❉✮❨❄❩★✩✧❅✧❅✮❁✮⑧❖➢✰✿★❁❲❚✮❫▼❉✮❁✪✭✴❅✰ ✶✹✮✱▼❉✰❁❞ ✌ ❞☛✌➤✺✭❙❳✶✿✸✫✮❨✰✾✶✹★✩❄✬✛ ❂❃▼✹★✩◗❘✮❫✺✭❂❴✶✹✸✻✮❨❄❩★✩✧❅✧❅✴❅✥✻✪❵❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥❡❏❦t ♣◆t ♠ ❯▲➀❯❧ ✉✈❤❦❥✔❞ ✍ ❞☛✎❚✬✻◗①❙⑩✶✹✺④✶✿✸✫✮❨❄❩★✩✧❅✧❅✮✱✮✯❞ ❞ ➛✖➦❨➒❺➛✰✯➝↕❊➒❺➣➢→⑧➣ ◗❚➣♥➐✦→❊➟ ✮ ➏✷➣✜→❊➩②➏✷➦❨➏✷➛❚➒❁➐✦→⑧➡❇➨ ✯❇➐➓➙✯→■↕✿➜❯➒❺➩➑→⑧➣✦↕❊➏✷➛✯➭✢➟❚➙❚➒❺➣✦→❸➜⑥➞❝➐ ➙✭→■↕✹➜⑥➦◆➟③➏✷➩✷→✹➠❊➳ ❆ ➩✷➣✦➜ ◗✭➣➢➐✦→❊➟③➣ ✵ ➒⑥➛✯➡ ▼ ➒❩➠➢→❸→❊➩②➏✷➦❨➏✷➛❚➒❁➐✦→⑧➡✇➨r→⑧↕✹➒⑥➥✯➣➢→ ➐ ➙✯→✳↕✹➒❺➩②➩✷➏✷➛✯➭✢➞✍➥❚➛❚↕✿➐➓➏➑➜❯➛➝➙✯➒⑥➣➤➛✯➜◆➣➢➐➓➒❺↕ ➔ ➞✄➠➓➒❺➦◆→✑✏ ➒❺➛ ✯ ➞✠➥✯➛❚↕✿➐➓➏✷➜⑥➛ ➐ ➙❚➒❁➐ ↕❊➒❺➛④➡✭➜❫➒⑥➩✷➩✫➏➲➐ ➣➫↕✹➜⑥➦◆➟③➥✭➐➓➒❁➐➓➏✷➜⑥➛✖➏✷➛④↕✹➒⑥➩✷➩➑→❊→❖✱ ➣✦➒❑➧❯→ ➠➢→❊➭⑥➏✷➣♥➐➓→✹➠➓➣➫➛✯→✹→⑧➡❚➣↔➛✯➜❨➞✄➠➓➒❺➦◆→❺➳ ✚✳✸r✬✻✰❁❏✫★✖✶✹★✩✴❅✧ ❄❁★✭✧❅✧❡❄❩★✩✥❱❬➉✮❫★✭✰✵❄❊✸✫✮❩★✩❙✚★✭✰✵★✒✂☎✄✝✆✟✞✚✴❅✥✻✰✾✶❉▼❉✬✫❄✔✶✿✴❅✺✭✥ ❪

printTable: allocate record r1 printTable: allocate stack frame jump to doListX jump to whileL doListX: allocate record r2 whileL: if l=nil goto doneL if l=nil goto doneL

i := r2.l.head i := l.head

allocate record r3 jump to putInt call putInt again: add SL.i+SL.i add i+i jump to putInt call putInt doRest: jump to doListX jump to whileL doneL : jump to SL.cFunc doneL: return

(a) Functional program (b) Imperative program FIGURE 15.13. printTable as compiled. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel type tree = {key: ()->key, binding: ()->binding, left: ()->tree, right: ()->tree} function look(t: ()->tree, k: ()->key) : ()->binding = if k() < t().key() then look(t().left,k) else if k() > t().key() then look(t().right,k) else t().binding PROGRAM 15.14. Call-by-name transformation applied to Program 15.3a. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

slide-12
SLIDE 12 ✂✁ ✲✛✧✩✚✪✜ ✫✭✬✛✧✾✽
  • ✵❆✧
❅ ✫✭✬✹✜✤✬✼❂ ✜✤✬ ✷✹✲✸✬✛✺ ✚✢✜✦✫✭✬✛✧ ✽ ✰❛✴✢✫✾❂✯✴✢✧✾✣ ❅ ❾❿✥✻✮❨✴❅◗❘❙❭✺✩▼ ✶❊★✩✥❚✶❿❙✼▼✿✴②✥✫❄❁✴②❙✫✧❅✮✇✺✭❂ ✮❀✩r✬✫★❯✶✹✴❅✺✭✥✫★✩✧ ▼✿✮❩★✩✰❉✺✭✥✫✴②✥✫✪①✴❅✰ ✄ ✬ ✞✱✑✆☎ ✞ ✓ ✕ ✓✖✑ ✓✖✕ ✗✙☛ ⑨ ✴❅❂ ☎ ❆☛✝❭❍✞✝✠✟❷❏r✶✹✸✻✮❁✥❱★✩✥❚❶✚★✩❙✻❙✫✧❅✴❅❄❁★❯✶✹✴❅✺✭✥ ☎ ❆☛✡✖❍ ✶✿✺❵★✭✥✚✮s✉✼❙✻▼❉✮❁✰❉✰❉✴❅✺✭✥✂✡ ✴❅✰ ✮ ✩❛✬✫✴✷❲✩★✩✧❅✮✱✥③✶■✶✹✺☞✟ ✲✽✴➑✶✹✸❱✮✔❲❚✮✱▼ ❶❳✺❛❄❁❄❁✬✼▼✾▼✿✮❁✥✻❄❁✮◆✺✭❂✆✝❋▼✿✮✱❙✫✧✄★✩❄❁✮✱❀⑩✲✽✴✷✶✿✸✌✡ ❞ ✝ ❱✟✞ ✝ ❱✟✞ ❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛ ✝ ❩ ❩✎✍♠❢✑✏ ▲✒✍✓☛✔✞❥✐ ▲ ✍✓☛✔✞❚◆ ❞✡✠☞☛ ❳✌✞✎✍❍❩✖☛ ✝ ❩ ❩✎✍♠❢✑✏ ▲✒✍✓☛✔✞❥✐ ▲ ✍✓☛✔✞❚◆ ✍ ❞✒✏✔✓✖✕ ✞✑✏❫❱✖☛✗✏ ✍ ❞✒✏✔✓✖✕ ✞✑✏❫❱✖☛✗✏ ❱ ✝ ✏ ❱ ✝ ❩ ❩✎✍♠❢✑✏❑✐ ❱ ✝ ✏ ❱ ✝ ❩ ❩✎✍♠❢✑✏❑✐ ❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛ ❞❣❢ ❝ ▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆ ❞✡✠☞☛ ❳✌✞✎✍❍❩✖☛ ❞❣❢ ❝ ▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆ ✍ ❞❯❦✘✓✖✙ ✞✑✏❫❱✖☛■❝ ✍ ❞❯❦✘✓✖✙ ✞✑✏❫❱✖☛■❝ ❱ ✝ ✏ ❱✛✚ ❦ ❱ ✝ ✏ ❱✛✚ ❦ ✍✓☛ ✍✓☛ ✍ ❞❯❦✘✓✖✙ ✞✑✏❫❱✖☛ ✝ ❩ ❩✎✍♠❢❤❦❥✐ ❞❣❢ ✝ ❩ ❩✎✍♠❢❤❦❥✐ ✐ ❱ ✝ ✏ ❱✛✚ ❦ ❱✖☛❨❬ ❱✖☛❨❬ ✜ ✁✣✢✥✤ ✁ ✓ ✁➝✒❁✗✼✁ ☞✕✑✔✓✗✖ ✣ ✤✦✥✚❙✫✬✼▼❉✮❫❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥❝★✩✧ ✧✄★✩✥✻✪✯✬✫★✩✪✭✮❁✰❁❏✻✴❅❂➤★❘❙✻▼❉✺✭✪✩▼✹★✩◗ ✦ ✴❅✰✵✺✭❬✼✶✹★✩✴❅✥✫✮❁❀✚✬✫✰❉✴❅✥✻✪ ✄❡❖♥✰❉✬✫❬✻✰✾✶✿✴✷✶✿✬✼✶✿✴❅✺✭✥✫✰✵❂❃▼❉✺✭◗ ✟❷❏r✶✹✸✻✮❁✥✚❬➉✺✩✶✿✸✚❙✼▼✿✺✭✪✩▼✿★✭◗❘✰■✲✽✴❅✧②✧ ✥✻✮✔❲❚✮✱▼✵✪✭✴✷❲❚✮ ❀✫✴ ❅➉✮✱▼❉✮❁✥❚✶✵▼✿✮✱✰✿✬✻✧✷✶✿✰❫t ♣✇♠❱❯✼❥☎☛✼❜✿✉✭♠❱❯ ❯▲➀✭⑤➑♠☎✠✫✸✫✺❩✲ ✮✔❲❚✮✱▼❁❏✧✦ ★✩✥✻❀✌✟ ★✈▼✿✮✇✥✻✺✈✶ ✥✫✮✱❄❁✮❁✰❉✰✿★✩▼❉✴❅✧✷❶⑩✮ ✩❛✬✫✴✷❲✩★✩✧❅✮✱✥③✶✢★✩✰■✶✿✸✻✮✔❶⑩◗❘✴❅✪✭✸❚✶❿✥✻✺✈✶✽✸✫★✭✧➑✶✢✺✭✥❳✶✿✸✫✮❨✰✿★✩◗❘✮✇✴❅✥✻❙✫✬▲✶✹✰ ❪ ✣ ✚ ✺❘▼❉✮❁◗❘✮❁❀▲❶❷✶✿✸✫✴②✰➝❆❈❙❝★✈▼ ✶✹✴✄★✩✧✠❍❸❂❈★✩✴❅✧❅✬✼▼✿✮✇✺✭❂ ✮ ✩❛✬❝★❯✶✿✴❅✺✭✥❝★✩✧ ▼❉✮❩★✩✰✿✺✭✥✻✴❅✥✻✪✫❏▲✲ ✮✇❄❁★✭✥ ✴❅✥❚✶✿▼❉✺r❀✻✬✻❄❁✮ ⑤②➀✩★☎☛❳❥❑❹✈➀✭⑤➁q✫➀✭♠❈tP✉✈❤ ✴❅✥❚✶✹✺④✶✹✸✻✮❫❙✼▼✿✺✭✪✩▼✹★✩◗❘◗❘✴❅✥✫✪❵✧✄★✭✥✻✪✭✬❝★✩✪✭✮✯❞ ✣ ✪❿✥✻❀✫✮✱▼■✧✄★❋❇✔❶⑩✮✔❲✩★✩✧❅✬❝★❯✶✿✴❅✺✭✥ ❏❴➀✈❤ ❥ ✆ ✫❽⑦✹❥⑧❧✹❧✹tP✉✈❤✐t❃❧❨❤❭✉✭♠❸❥❑❹✈➀✭⑤➁q✫➀✭♠♥❥✿♦❼qr❤➉⑤❅❥⑧❧✿❧❫t ♠❜❧ ❹✩➀✩⑤➲q❝❥✇t✠❧➝♦③❥⑧❻❼➀❯❤❦♦❚❥✿♦✼❜☎☛①❧✱✉✈❻❼❥✖✉✭♠❱❯✼❥⑧⑦P✫✼➀✈⑦✱♠ ✉ ♣❫♠❱❯✼❥✖s✹✉✈❻ ✫❽q✼♠ ➀✭♠❈tP✉✈❤❽❞ ✣ ✤✦✥✚❄❁✺✭✥❚✶✿▼✿★✩✰✾✶❩❏ ❧❑♠❈⑦⑧tPs❁♠ ⑤❅➀❯❤❄❃✈q✫➀ ❃③❥⑧❧ ❆ ✡ ☎ ❏❝●❪❏ ✎③★❁❲✩★✼❏✴✁↔▼❉✧✄★✭✥✻✪③❍❸✮✔❲✩★✩✧❅✬❝★❯✶✿✮❫✮❩★✩❄⑧✸ ✮s✉✼❙✻▼❉✮❁✰❉✰❉✴❅✺✭✥❋★✩✰✳✶✿✸✫✮❨❄❁✺✭✥③✶❉▼❉✺✯✧★t✫✺❩✲ ✺✭❂ ✶✿✸✫✮❨❙✼▼✿✺✭✪✩▼✿★✭◗ ▼❉✮❩★✩❄⑧✸✻✮❁✰✳✴✷✶❺❞
slide-13
SLIDE 13 ❯✧ ✽✤✽ ✂✁☎✄ ✝✆ ✧✾✣ ✵
✧ ✽✤✲✛✧✩✚✪✜ ✫✭✬ ✡ ✺✯✰ ✶✵✧✄★✭✥✻✪✭✬❝★✩✪✭✮❁✰■❙❝★✩✰❉✰■❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥❋★✈▼✿✪✭✬✻◗①✮✱✥③✶✿✰■✬✫✰❉✴❅✥✻✪ s✹➀✩⑤❜⑤ ❛❵❜☎☛ ❛ ❹✩➀✩⑤➲q❝❥ ⑨ →❺➳ ➭③➳ ➥✯➟r➜⑥➛④➒❨↕❊➒❺➩②➩▲➐✦➜ ❞❣❢ ✏ ❢ ❝❑✐ ✐ ◗❡❏❚➠➓➣♥➐ ✏ ❢ ❝❑✐ ➏②➣➫↕✹➜⑥➦◆➟③➥✭➐✦→⑧➡✖➒❺➛❚➡✖➐➓➙✯→■➠➢→⑧➣✦➥❚➩➲➐ ➏✷➣➫➟❚➒⑥➣✦➣➢→⑧➡ ➐➓➜ ❞ ➳ ✾➫➙✯→✵↕✹➜⑥➦◆➟③➥✭➐➓➒❁➐ ➏➑➜⑥➛✖➏✷➣➫➥❚➛❚➛✯→⑧↕✿→⑧➣✦➣✦➒❺➠ ✯✖➏➑➞ ❞ ➡✯➜✈→⑧➣↔➛✯➜❩➐ ➛✯→❊→❊➡ ➐➓➜❨➥❚➣➢→✵➏➲➐ ➣➫➒❩➠➢➭❯➥✯➦◆→⑧➛❯➐✟✞ ✠ ➀✭⑤❜⑤ ❛❵❜☎☛ ❛ ❤❭➀✈❻ ❥ ✮❑❲✩★✩✧❅✬❝★❯✶✿✴❅✺✭✥ ★❁❲❚✺✭✴❅❀✻✰■✶✿✸✫✴②✰✽❙✼▼✿✺✭❬✻✧❅✮❁◗✚❞✞✪✢✥✫❀✻✮✱▼✳✶✿✸✻✴❅✰✵✮❑❲✭★✩✧❅✬✫★❯✶✹✴❅✺✭✥ ✰❉❄⑧✸✻✮❁◗❘✮✯❏✼✮❩★✩❄❊✸⑩❲✩★✈▼✿✴✄★✩❬✻✧❅✮❇✴❅✰✽✥✻✺✈✶✢★④✰❉✴❅◗①❙✻✧❅✮❫❲✩★✩✧❅✬✻✮✇❬✻✬✼✶✵★ ♠❱❯❚qr❤✻➂ ⑨ ★④❂❜✬✻✥✫❄✔✶✿✴❅✺✭✥ ✶✿✸❝★❯✶✵❄❁✺✭◗①❙✻✬▲✶✹✮❁✰ ✶✹✸✻✮◆❲✩★✩✧❅✬✫✮❨✺✯❂ ✶✹✸✻✮❪❲✩★✩▼❉✴✄★✩❬✻✧❅✮❇✺✭✥❱❀✻✮❁◗①★✩✥✫❀❡❞ ✳✭✪✓✎ ✳✭✪✓✎ ✬✖❋✓✫✺❋ ✥ ✸☛✡✌☞✌✍ ✟✘✠✤☛✍✌✡✎✑✏✭✒✛☛ ❋●✜❇✷✹✸☛✡✟☞✎✍ ✏❑☛ ✏ ✏❑☛ ❋✑☞✓✒✕✔ ❋✿✜❇✷✖☞✓✒✗✔ ✪✔☛✖✕ ✪✔☛✖✕ ✾➫➙✯→✳➟❚➠➢➜⑥➨❚➩✷→❊➦ ❥ ➏➑➐➓➙④↕✹➒⑥➩✷➩ ✱ ➨✶✯ ✱ ➛❚➒❺➦◆→✳➏✷➣➤➐ ➙✯➒❩➐↔→⑧➒❺↕✾➙➝➐➓➙✩➥❚➛✭➔✖➦❨➒✬✯ ➨r→✵→❖❊✯→⑧↕✹➥✭➐➓→❊➡④➦❨➒❺➛ ✯ ➐➓➏✷➦◆→⑧➣ ◗❚➠➢→❊➟r→⑧➒❁➐✦→⑧➡❚➩❝✯ ➟❚➠➢➜✭➡❚➥❚↕✹➏②➛✭➭❨➐ ➙✭→✵➣✦➒❺➦◆→✳➠➢→⑧➣✦➥❚➩➲➐⑧➳ ✑ ✁➝✒✱✒ ✆ ✂ ✤ ✆✙✘ ✛✽✛✎✍ ✚ ✜ ✁✣✢✥✤ ✁ ✓☎✁ ✒❁✗✼✁ ☞✕✑✔✓✗✖✜✛ ✣ ✤♥✶■✴❅✰✵★✖◗①✺❛❀✻✴ ✧❝❄❁★✈✶✿✴❅✺✭✥❱✺✭❂❴❄❩★✩✧❅✧➑❖♥❬❚❶❛❖♥✥✫★✩◗①✮◆✶✿✸✫★✈✶■✥✫✮✔❲❚✮✔▼✳✮✔❲✩★✩✧❅✬❝★❯✶✿✮❁✰❸✶✿✸✻✮❨✰✿★✩◗❘✮ ✶✹✸❛✬✻✥ ✛①✶✦✲✵✴❅❄❁✮✯❞ ✣ ✁ ★✩❄⑧✸⑩✶✹✸❛✬✫✥✜✛ ✴❅✰✵✮ ✩❛✬✻✴❅❙✫❙➉✮❁❀⑩✲✵✴✷✶✹✸❋★ ❻ ❥⑧❻❼✉❘❧❑⑤❅✉✩♠ ✶✿✸✫★✈✶✵✰✾✶✿✺✩▼✿✮✱✰✵✴✷✶✿✰■❲✩★✩✧❅✬✫✮✭❞ ✁ ★✩❄⑧✸✚✮✔❲✩★✩✧❅✬❝★❯✶✿✴❅✺✭✥❋✺✭❂ ✶✿✸✫✮◆✶✿✸❛✬✫✥✜✛ ❄⑧✸✻✮❁❄✔✛r✰ ✶✹✸✻✮❫◗❘✮❁◗❘✺❵✰❉✧❅✺✈✶❩⑨ ➏➑➞❭➞✍➥❚➩✷➩ ◗✯➐➓➙✯→ ✢✤✣✥✢✤✦★✧✪✩✎✣ ✻ ➧❁➒❺➩✷➥✯→■➏✷➣✜➠➢→✹➐ ➥✭➠➓➛✭→⑧➡✜✳r➏➑➞❭→⑧➦◆➟✭➐♠✯✰◗✯➐ ➙✯→❸➐➓➙✩➥❚➛✯➔➝➞✍➥❚➛❚↕✿➐➓➏➑➜⑥➛✖➏✷➣↔↕❊➒❺➩②➩➑→⑧➡ ❞ ✣ ✚■✸❛✬✫✥✜✛❛✰✵❄❁★✭✥❳❬❭✮❨▼❉✮❁❙✼▼✿✮❁✰❉✮❁✥❚✶✿✮❁❀✚★✩✰✳✶➢✲ ✺✈❖♥✮✱✧❅✮❁◗❘✮❁✥❚✶✢▼❉✮❁❄❁✺✩▼❉❀✫✰■✺✭❂ ✶✹✸✻✮❨❂❜✺✩▼✿◗ ✫ ♠❱❯❚qr❤✻➂ ♣❊qr❤❭s✱♠ t ✉✈❤✭✬✔❻ ❥⑧❻❼✉ ❧❑⑤②✉✭♠✯✮ ❆ ➛ ✰✟✹ ✣✯✱ ✷✳✲✴✰✭✷✶✵ ✣ ✻ ➐ ➙✈➥❚➛✯➔➝↕✹➜⑥➛❯➐➓➒❺➏✷➛❚➣➫➒⑥➛✖➒❩➠✦➨③➏➲➐✦➠✦➒❺➠ ✯❇➐ ➙✈➥❚➛✯➔ ➞✍➥❚➛❚↕✿➐➓➏➑➜❯➛✴◗❛➒❺➛❚➡➝➐ ➙✭→ ➦◆→⑧➦◆➜❨➣✦➩✷➜❩➐↔➏✷➣↔➒◆➣♥➐➓➒❁➐ ➏✷↕✳➩✷➏✷➛✯➔✇➐✦➜❨➨r→✵➥❚➣➢→❊➡❘➏✷➛④↕❊➒❺➩✷➩✷➏②➛✭➭❿➐➓➙✯→■➐➓➙✈➥❚➛✯➔ ➞✠➥❚➛✯↕✿➐➓➏✷➜⑥➛✻➳ ❆ ➛ ✣✯✱ ✷✳✲✴✰✭✷✶✵ ✣ ✻ ➐➓➙✩➥✯➛✯➔➝➙❚➒❺➣✜➐ ➙✭→✵➟❚➠➢→✹➧✭➏✷➜⑥➥❚➣✦➩❝✯➝↕✿➜⑥➦❨➟❚➥✭➐✦→⑧➡➝➧❁➒❺➩✷➥✯→✵➏✷➛④➏➲➐➓➣➫➦❨→❊➦◆➜❫➣✦➩➑➜❩➐✔◗ ➒❺➛❚➡④➏➲➐➓➣✜➐ ➙✈➥❚➛✯➔ ➞✠➥✯➛❚↕✿➐➓➏✷➜⑥➛ ✿♥➥❚➣♥➐↔➠✦→✿➐ ➥✭➠➓➛❚➣➫➐ ➙✭→✵➦◆→⑧➦◆➜ ✱ ➣✦➩➑➜❺➐➤➧❁➒❺➩②➥✭→❺➳
slide-14
SLIDE 14 ✗✙✘✛✚✢✜✤✣ ✜✦✥★✧ ✚✢✜✦✫✭✬ ✫✯✮✱✿❁✧ ✥ ✄ ✷✹✲✸✬✹✺✻✚✢✜✦✫✭✬✛✧ ✽ ✰ ✴✢✫✾❂✯✴✪✧ ✣ ❅ ☎ ★❋❇✔❶⑩❂❃✬✫✥✻❄✔✶✿✴❅✺✯✥✫★✩✧❡✧✄★✩✥✫✪✭✬✫★✩✪✭✮❁✰✵❄❁★✭✥✚✬✫✰❉✮❪✶✿✸✫✮❫✰✿★✩◗❘✮ ✛r✴❅✥✻❀✻✰✽✺✭❂ ✺✭❙▲✶✹✴❅◗❘✴❈❇❩★❯✶✿✴❅✺✭✥✫✰✢★✩✰ ✴❅◗❘❙➉✮✱▼✹★❯✶✿✴✷❲❚✮✇✺✩▼✽✰ ✶❉▼✿✴❅❄❑✶✢❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥✫★✩✧❡✧✄★✩✥✫✪✭✬✫★✭✪✭✮✱✰✽★✩✥✻❀❱◗❘✺✭▼❉✮ ❪ ☎ ✺✩▼✽✮s✉✻★✩◗❘❙✫✧❅✮✭⑨ ✁✄✂✆☎✞✝✠✟☛✡☞✝✠✂✍✌✏✎✒✑✞✡✔✓✕✌✔✡✔✂✗✖ ✚✳✸✫✮❨❂❜✺✭✧❅✧②✺❩✲✽✴❅✥✻✪❼✴❅✰✢★✖❲✩★✩✧❅✴❅❀✚✶❉▼✹★✩✥✻✰✿❂❃✺✭▼❉◗①★✈✶✿✴❅✺✭✥❋✴❅✥ ★ ✧✄★❋❇❑❶✚❂❜✬✻✥✻❄✔✶✹✴❅✺✭✥✫★✩✧ ✧✄★✩✥✫✪✭✬✫★✭✪✭✮✯⑨ ✟✡✠☞☛✍✌✡✎✑✏✓✒✔☛ ✟❈✜ ✏●✥ ✏✯☛✼✎✍✷●✥▼✏✯☛✼✎✰✟✘✠✤☛ ✸ ✟✘✠✤☛✍✌✡✎✑✏✭✒✛☛ ✟✿✜ ✏✿✥▲✏❑☛✰✎✍✷●✥▼✏❑☛✰✎✰✟✘✠✤☛ ✸ ✳✭✪✓✎ ✳✭✪✓✎ ✬✖❋✓✫ ❁✩✏ ✥ ✸✹❁✶✜ ✏☞✷ ✟✘✠✤☛✍✌✡✎✑✏✭✒✛☛✙✘❈✜✛✚✲✥▲✏❑☛✰✎✍✷✹✸❀❁✦✜ ✏✰✷✢✜✣✚ ✟✘✠✤☛✩✌✔✎✍✏✓✒✛☛✙✘❈✜✤✚✾✥▲✏❑☛✰✎✩✷✹✸✹❁✩✏✥✜✦✚ ✏✯☛✧✘ ✏❑☛★✘ ✪✔☛✖✕ ✪✔☛✖✕ ➨❚➥✭➐ ➛✯➜❩➐ ➏②➛✖➒❨➣➢➐✦➠✦➏✷↕✿➐ ➩✷➒❺➛✯➭⑥➥❚➒❩➭❺→✳➏➑➞➉➐➓➙✯→■➐✦➠✦➒❺➛❚➣➢➞✍➜❺➠✦➦❨➒❩➐➓➏➑➜⑥➛➝➒❺➟✯➟▲→❊➒❺➠✦➣ ➏✷➛④➒❨↕✿➜❯➛⑥➐✦→❂❊✭➐↔➒❺➣ ❉❋❊❍● ❊ ▲ ◆❯❞❣❢✪✩❋r❫✐ ❥ ➙✯→❊➠➢→ ❊ ➏②➣➫➛✯→✿➧❯→✹➠ ↕✹➒❺➩②➩➑→⑧➡✖➒❁➐↔➒❺➩②➩✫➒❺➛❚➡ ✏♠❢✪✩❋r❨✐ ➏✷➛✤❏❛➛❚➏➲➐✦→⑧➩❝✯➝➩➑➜✩➜❺➟③➣✹➳ ✫ ✵❆✧✭✬✁ ✳✫✮✬✼✵
✣ ✫ ☎ ✧ ✽ ✦✢✥✫✺✈✶✿✸✫✮✱▼■✰✿✬✻❬▲✶✹✧❅✮❫❙✼▼❉✺✯❬✻✧❅✮❁◗ ✲✽✴✷✶✿✸❱✰✾✶❉▼✿✴②❄✔✶✢❙✼▼✿✺✭✪✩▼✿★✩◗①◗❘✴❅✥✻✪❼✧✄★✩✥✫✪✭✬✫★✭✪✭✮✱✰✵✴❅✰✳✶✿✸✫✮ ▼❉✮❁◗❘✺❩❲✩★✩✧ ✺✭❂ ❀✫✮❁★✭❀✚❄❁✺❛❀✫✮✭❞
  • ✺✭✥✻✰✿✴❅❀✻✮✱▼❁⑨
❞✡✠☞☛ ❳✌✞✎✍❍❩✌☛✙❞ ❢ ✍✻▲✒✍✓☛✔✞❥✐ ▲ ✍✓☛✔✞◗◆ ✝ ❱✟✞❚❉❋❊❍● ❬ ▲❖◆ ✏ ❢ ❝❑✐ ✍✓☛ ✍ ♥◗r ❱✖☛❨❬ ✯ ❞ ➛❘➒❺➛④➏✷➦◆➟r→❊➠✦➒❁➐ ➏➲➧⑥→✳➩✷➒⑥➛✭➭❯➥✯➒❺➭❺→ ❈✠→❺➳ ➭❚➳✴◆✙❍❵◗ ❥➤→✵↕❊➒❺➛❚➛✭➜❺➐↔➠➢→⑧➦◆➜✔➧⑥→ ✏ ❢ ❝❑✐ ➨r→❊↕❊➒❺➥❚➣➢→✽➏➲➐ ➦❨➏➑➭❯➙⑥➐↔↕✿➜❯➛⑥➐➓➒⑥➏✷➛✖➣✦➏✷➡✯→❂✱ →✿➯✼→⑧↕✿➐➓➣➤➐ ➙✯➒❩➐ ➒❩➠➢→✵➛✯→✹→⑧➡✯→⑧➡✖➨✶✯❇➐➓➙✯→✵➟❚➠➢➜❺➭❺➠➓➒❺➦✖➳ ✯ ❞ ➛❘➒❨➣♥➐✦➠➓➏✷↕✿➐➫➟③➥✯➠➢→■➞✠➥❚➛❚↕❉➐ ➏➑➜⑥➛❚➒❺➩✫➩②➒❺➛✯➭⑥➥❚➒❩➭❺→✐◗✯➠✦→❊➦◆➜✔➧✯➏✷➛✯➭ ✏ ❢ ❝❑✐ ➦❨➏➑➭⑥➙❯➐➤➐ ➥✯➠✦➛❘➒ ➛✯➜⑥➛▲✱❈➐✦→❊➠✦➦❨➏②➛✯➒❩➐➓➏✷➛✯➭❨↕✹➜⑥➦◆➟③➥✭➐➓➒❁➐ ➏➑➜⑥➛✖➏✷➛❯➐✦➜❨➒❪➐➓→✹➠➓➦❨➏✷➛❚➒❁➐➓➏②➛✭➭◆➜⑥➛✯→ ✞ ✯ ❞ ➛❘➒❨➩✷➒ ❋ ✯❇➞✍➥❚↕✿➐➓➏✷➜⑥➛❚➒❺➩✫➩✷➒❺➛✯➭⑥➥❚➒❩➭⑥→ ◗ ✏ ❢ ❝❑✐ ↕✹➒⑥➛➝➨r→✽➣✦➒❩➞✍→⑧➩❝✯✇➠✦→⑧➦◆➜❑➧❯→❊➡✻➳
slide-15
SLIDE 15 ✫ ✵♠✮ ✫✯✴✢✵❆❅❥✚ ✧ ✚✢✜✦✫✭✬ ✤➢✥❋★✩✥❚❶❳✧❅★✭✥✻✪✭✬❝★✩✪✭✮✯❏✻✴✷✶✢✴❅✰✵❄❁✺✭◗❘◗❘✺✯✥❳✶✿✺①❬✼▼✿✮❁★✤✛❷★❘❙✻▼❉✺✭✪✩▼✹★✩◗ ✴❅✥③✶✿✺❵★❘❙❝★✈▼ ✶✵✶✿✸❝★❯✶ ❙✼▼✿✺❛❀✻✬✫❄✱✮❁✰■★❘❀❝★❯✶✹★❘✰ ✶❉▼✿✬✻❄✔✶✿✬✻▼❉✮✇★✩✥✫❀✚★✭✥✻✺✈✶✹✸✻✮✱▼■❙❝★✈▼ ✶✵✶✿✸❝★❯✶✽❄✱✺✭✥✫✰❉✬✫◗❘✮❁✰✳✴✷✶❺❞
  • ✄✝✆✂✁☎✄
✄ ✫ ✭ ✥ ✸ ✣
  • ✄✝✆
✘ ✆ ✫ ✞
✄ ✫ ✭ ✥ ✘ ✄ ✞ ✧✝✆ ✞ ✸✔✜✦✜ ✟ ❆ ✻ ✣✡✠✟✦☞☛✗✣✍✌ ✵ ✷✶✵ ✧ ✦ ✹ ➐✦➠✦➒❺➛❚➣➢➞✍➜❺➠✦➦❨➒❩➐➓➏➑➜⑥➛ ➠➢→⑧➦◆➜✔➧⑥→❸➏✷➛❯➐✦→❊➠✦➦◆→⑧➡❚➏✷➒❁➐✦→❸➩✷➏✷➣♥➐ ➣➤➒❺➛❚➡ ➐✦➠✦→✹→⑧➣✜➒⑥➛❚➡ ➟r→❊➠➢➞✍➜❺➠✦➦❫➣➫➒⑥➩✷➩✼➜⑥➟r→✹➠➓➒❁➐➓➏✷➜⑥➛❚➣↔➏✷➛➝➜❯➛✭→■➟③➒❺➣✦➣✹➳ ✟ ✎ →❊➞✄➜⑥➠➢→⑧➣♥➐➓➒❁➐ ➏➑➜⑥➛➝➏✷➣↔➛✭➜❺➐➫➧❁➒❺➩✷➏✷➡✖➏②➛ ➐ ➙✭→■➟❚➠➢→⑧➣➢→⑧➛❚↕✿→■➜❺➞ ➣✦➏✷➡✯→❖✱ →✹➯✼→⑧↕✿➐➓➣✜➨r→⑧↕❊➒❺➥❚➣➢→■➏➑➐ ❈❜➥✯➣✦➥❚➒❺➩②➩❝✯❡❍✘↕✾➙❚➒❺➛✯➭❺→⑧➣➤➐ ➙✭→■➜❺➠✦➡✯→❊➠↔➜❺➞❭➜❺➟r→❊➠✦➒❁➐ ➏➑➜⑥➛❚➣✹➳ ✟ ✎ →❊➞✄➜⑥➠➢→⑧➣♥➐➓➒❁➐ ➏➑➜⑥➛➝➏✷➣↔➒❺➩❝❥✜➒ ✯✭➣✜➩➑→❊➭⑥➒❺➩✫➏✷➛➝➟③➥✯➠➢→✵➞✍➥❚➛❚↕✿➐➓➏➑➜❯➛✯➒⑥➩✫➩✷➒❺➛✯➭⑥➥❚➒❩➭⑥→❊➣✹➳ ✏✓✠✑✏✓✒✕✔✡✠❑❊❍●❲❱✗✖❨❱ ❞✙❊❋❳ ❳✘✏ ☛■◆ ✍ ❞✙✏ ✓ ☛ ✞✑✏❫❱✖☛ ❊❋❳ ❳ ❱ ✝ ✏ ❱ ✏✓✠✕✏✓✒✕✔✡✠❑❊❍●❲❱✗✖❨❱ ❞ ❢ ❊❋❳ ❳❛♥ ✏☞✔✡✠❑❊❍●❲❱✙✏✪✐ ❢✚✏ ♥q❏ ✐ ☛ ❱✖☛❨❬

type intList = {head: int, tail: intList} type intfun = int->int type int2fun = (int,int) -> int function sumSq(inc: intfun, mul: int2fun, add: int2fun) : int = let function range(i: int, j: int) : intList = if i>j then nil else intList{head=i, tail=range(inc(i),j)} function squares(l: intList) : intList = if l=nil then nil else intList{head=mul(l.head,l.head), tail=squares(l.tail)} function sum(accum: int, l: intList) : int = if l=nil then accum else sum(add(accum,l.head), l.tail) in sum(0,squares(range(1,100))) end PROGRAM 15.15. Summing the squares. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel function look(t: tree, k: key) : ()->binding = if k < t.key() then look(t.left(),k) else if k > t.key() then look(t.right(),k) else t.binding PROGRAM 15.16. Partial call-by-name using the results of strictness analysis; compare with Program 15.14. From Modern Compiler Implementation in ML, Cambridge University Press, c 1998 Andrew W. Appel

slide-16
SLIDE 16
✙ ✑❀✠✻☞✕✖✚✛✢✕ ✕ ✞ ✖✼✁ ✒ ✤❳✕ ✑✱✕ ✚✳✸✫✮❫✺❩❲❚✮✱▼❉✸✻✮❩★✩❀✚✺✭❂❴✶✹✸❛✬✻✥ ✛❼❄✱▼✿✮❁★❯✶✹✴❅✺✭✥❋★✭✥✻❀✚✮❑❲✩★✭✧❅✬✫★❯✶✹✴②✺✯✥❋✴❅✰❉✩❛✬✫✴✷✶✿✮❫✸✻✴❅✪✯✸❡❞ ✤ ✶✽✴②✰✢❬➉✮✔✶✾✶✹✮✔▼❸✶✹✺❘✬✻✰✿✮◆✶✿✸❛✬✫✥✜✛r✰✳✺✭✥✫✧✷❶❷✲✽✸✻✮✱▼❉✮◆✶✹✸✻✮✔❶⑩★✩▼❉✮✇✥✻✮❁✮❁❀✻✮❁❀❡⑨ ➏➑➞❭➒❪➞✠➥❚➛❚↕❉➐ ➏➑➜⑥➛ ✔ ❈ ✦✜❍ ➏✷➣➫↕✹→❊➠♥➐➓➒❺➏②➛❇➐✦➜◆→✹➧❁➒❺➩✷➥❚➒❁➐➓→■➏➲➐➓➣✜➒❺➠➢➭⑥➥❚➦◆→⑧➛⑥➐ ✦ ◗✯➐ ➙✯→✹➠✦→■➏✷➣↔➛✭➜ ➛✯→❊→⑧➡❨➐✦➜✽➟③➒❺➣➓➣ ➒✵➐➓➙✈➥❚➛✯➔◆➞✍➜❺➠ ✦ ✳ ❥➤→ ↕❊➒❺➛ ✿➢➥❚➣♥➐✘➟③➒❺➣✦➣ ➒❺➛✇→✹➧❁➒❺➩✷➥❚➒❁➐➓→❊➡ ✦ ➏②➛✯➣➢➐✦→⑧➒❺➡ ✁✚→❸➒❩➠➢→ ➐➓➠✦➒❺➡❚➏✷➛✯➭❿➐✦➠✦➒❺➡❚➏②➛✭➭❨➒❺➛❇→✹➧❁➒❺➩✷➥❚➒❁➐ ➏➑➜⑥➛ ➛✭➜★❥ ➞✄➜❺➠✜➒❪↕✿→❊➠♥➐ ➒❺➏✷➛❇→✹➧⑥→⑧➛❯➐➓➥❚➒❺➩▲→✿➧❩➒❺➩✷➥❚➒❁➐➓➏✷➜⑥➛✻➳ ✦ ❂❜✬✻✥✫❄❑✶✹✴❅✺✭✥ ☎ ❆☛✝✄✂ ✬✆☎✝☎✝☎★✬✛✝✟✞✫❍ ✴②✰✚❧❑♠❈⑦❑tPs✱♠❫t❜❤ ✝✡✠ ✴❅❂✦❏ ✲✽✸✻✮❁✥✻✮✔❲❚✮✱▼ ☛ ✲❸✺✭✬✻✧❅❀ ❂❈★✩✴❅✧ ✶✹✺ ✶✿✮✱▼❉◗①✴❅✥✫★❯✶✹✮✭❏↔✶✹✸✻✮❁✥ ☎ ❆✌☞ ✂ ✬✝☎✝☎✆☎ ✬✍☞ ✠✌✎✏✂ ✬ ☛ ✬✑☞ ✠✓✒✔✂ ✬✆☎✝☎✝☎★✬✑☞ ✞ ❍ ★✩✧❅✰✿✺ ❂❜★✭✴❅✧②✰ ✶✹✺✖✶✹✮✔▼✿◗❘✴❅✥❝★❯✶✿✮✯❏✻▼❉✮❁✪✯★✈▼✿❀✻✧❅✮❁✰❉✰✵✺✭❂ ✲✽✸✻✮✔✶✹✸✻✮✱▼❸✶✹✸✻✮ ☞✖✕ ✶✿✮✱▼✿◗❘✴❅✥✫★❯✶✹✮✯❞
✙✭✑★✠✻☞✕✖❱✛✢✕ ✕ ✞ ✖✼✁➝✒ ✤⑩✕ ✑✱✕ ✚❡✠✳✓✗✖ ☞ ✛ ❞ ✠☞☛ ❳✌✞✎✍❍❩✌☛✙❞❣❢ ❝ ▲✒✍✓☛✔✞★❴ ❦♠▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆❡❝❯♥❯❝❡♥❯❦ ❞ ✠☞☛ ❳✌✞✎✍❍❩✌☛ ✏ ❢ ❝ ▲✒✍✓☛✔✞★❴ ❦♠▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞❚◆✑✍ ❞❯❝✔✓✖✕ ✞✑✏❫❱✖☛ ❦◗❱ ✝ ✏ ❱❡❝ ❞ ✠☞☛ ❳✌✞✎✍❍❩✌☛ ✏♠❢ ❝ ▲ ✏✌✞
  • ✎✍✓☛✔✏
❴ ❦♠▲✒✍✓☛✔✞❥✐ ▲ ✞
  • ❲❱
❱❯◆ ✞
  • ❲❱
❱ ❢✌✗❨❱ ❦❭◆ ❝ ❴❁❘ ✍✓☛❨❬ ✍✓☛ ✏❭◆ ❦★❴ ✝ ❱ ❞ ✞❭◆✡☛ ✍ ✝ ❴
  • ✎✍✌✏✑✏✔✞❭◆✡☛
✍ ✝ ✐ ❞ ✠☞☛ ❳✌✞✎✍❍❩✌☛✙✘ ❢ ❝ ▲✒✍✓☛✔✞❥✐ ▲✕✍✓☛✔✞◗◆✚✘ ❢ ✕❫✐ ✤✦✥✚✪✭✮❁✥✻✮✱▼✹★✩✧ ❏ ❥ ✆③➀❚s✱♠↔❧❑♠❈⑦⑧tPs❁♠❈❤❦❥❊❧✹❧❫t❜❤❩♣✱✉✈⑦❑❻❵➀✭♠❈tP✉✈❤ t✠❧❨❤❭✉✭♠ s✹✉✈❻ ✫❽q✼♠ ➀❡❜✔⑤✄❥ ✏ ➩✷➏➑➔❺→❸→❺➳ ➭❚➳③➩✷➏➑➧⑥→❊➛✯→⑧➣✦➣➫➒❺➛❚➡④➦❨➒❺➛ ✯❇➜❺➐➓➙✯→✹➠ ➡❚➒❁➐ ➒✝✛③➜★❥ ➒❺➛❚➒❺➩❝✯✯➣➢→⑧➣ ✏ ★✩✥✻❀❳✶✿✸r✬✻✰ ❄❁✺✭◗❘❙✫✴❅✧❅✮✔▼✿✰✵◗ ✬✫✰ ✶❫qr❧✱❥④➀❷s✹✉✈❤✻❧❁❥❑⑦⑧❹✈➀✭♠❈t❜❹✭❥✖➀✬✫ ✫❽⑦✿✉ ✆✭t❃❻❼➀✭♠❈tP✉✈❤➤⑨ ✲✵✸✫✮✱✥⑩✶✹✸✻✮❫✰ ✶✿▼❉✴❅❄✔✶✿✥✫✮✱✰✿✰■✺✭❂✘★❘❂❜✬✫✥✻❄✔✶✿✴❅✺✭✥❱★✈▼✿✪✭✬✻◗①✮✱✥③✶✽❄❩★✩✥✻✥✫✺✈✶✵❬➉✮ ❀✻✮✔✶✿✮✱▼❉◗①✴❅✥✻✮❁❀❡❏r✶✹✸✻✮✇★✈▼✿✪✭✬✻◗①✮✱✥③✶✵◗ ✬✫✰ ✶✢❬➉✮❫★✩✰✿✰❉✬✻◗①✮✱❀✚✥✫✺✭✥r❖♥✰✾✶❉▼✿✴②❄✔✶❺❞