on the expressive power
play

On the Expressive Power of Programming Languages 1 Historical - PowerPoint PPT Presentation

On the Expressive Power of Programming Languages 1 Historical Context Control Reduction delimiters DrScheme ( 1997) Parametricity (1983) Semantics ( 1992) ( 1990) This Progress and Revenge of the Son of R3R Scheme Preservation (1994)


  1. On the Expressive Power of Programming Languages 1

  2. Historical Context Control Reduction delimiters DrScheme ( 1997) Parametricity (1983) Semantics ( 1992) ( 1990) This Progress and Revenge of the Son of R3R Scheme Preservation (1994) paper the LISP Machine ( 1999) ( 1986 ) (1991) 2

  3. Historical Context 1991: Writes this 1994: Shriram pivots paper from CompBio after reading it 3

  4. Historical Context 1991: Writes this 1994: Shriram pivots 2010: Essence of 2019: nothing of note. paper from CompBio after JavaScript reading it 4

  5. Expressivity Language L’ 5

  6. Expressivity Constructs F Language L’ Language L 6

  7. Expressivity > Language L Language L’ 7

  8. Expressivity Constructs F 𝜚 (compiler) Language L’ 8

  9. Expressivity Let x = init in body Let x = ref 0 in x++ ( fun x -> body) init Let x = makeBox () in x.setRef(x.getRef + 1) 9

  10. Eliminable Constructs 10

  11. 11

  12. 12

  13. 13

  14. Let x = init in body 𝜚 ( Let x = init in body) => ( fun x -> 𝜚 (body)) 𝜚 (init) ( fun x -> body) init Eliminable: Example 14

  15. Contextual Equivalence Or Observational Equivalence 15

  16. e1 e2 16

  17. e1 e2 Context C Context C 17

  18. e1 e2 Context C Context C Distinguishing 18 Context

  19. x y C(a) = ( fun x, y -> a) 1 (throw 1) Contextual Equivalence: Example 19

  20. ( fun x, y -> x) ( fun x -> x) (throw 1) ( fun x, y -> y) ( fun x -> x) (throw 1) 1 (throw 1) ⊥ Contextual Equivalence: Example 20

  21. Expressivity 21

  22. is expressible in if Constructs F Language L 𝜚 satisfies E1, E2, E3 There is no distinguishing context for F and 𝜚 (F). F is eliminable 22

  23. Macro-expressivity 23

  24. For (init, test, update, body) While (test, body) Macro expressivity: Example 24

  25. For (init, test, update, body) For (init, test, upd, body) => init in While ( 𝜚 (test), 𝜚 (body) ++ 𝜚 (update)) While (test, body) Macro expressivity: Example 25

  26. Polymorphic let Call-by-value STLC Expressive but Macro-inexpressive 26

  27. Polymorphic let Let (x, e, b) => ( fun x -> subst (x, 𝜚 (e), 𝜚 (b))) 𝜚 (e) Call-by-value STLC Expressive! Expressive but Macro-inexpressive 27

  28. AST function, not a syntactic abstraction! Let (x, e, b) => ( fun x -> subst (x, 𝜚 (e), 𝜚 (b))) 𝜚 (e) Recursive macros are not a problem! Macro-based subst implementation will generate scoped macros. subst is truly performing a compile-time computation. Expressive but Macro-inexpressive 28

  29. What do we get? Eliminability (Macro) expressivity 29

  30. What do we get? Eliminability State Continuations Inexpressible (Macro) expressivity Lambda Calculus 30

  31. What do we get? Eliminability State Continuations Bad? (Macro) expressivity Lambda Calculus 31

  32. Case Study 32

  33. Essence of JavaScript * let x = { with (x) { a: 10, a + b + 10 b: 20, } } > 30 > { a: 10, b: 20 } * The Essence of JavaScript (2010); Arjun Guha, Claudiu Saftoiu, and Shriram Krishnamurthi 33

  34. Essence of JavaScript * let x = { with (x) { a: 10, a + b + 10 b: 20, } } > 30 > { a: 10, b: 20 } Lambda Calculus + objects * The Essence of JavaScript (2010); Arjun Guha, Claudiu Saftoiu, and Shriram Krishnamurthi 34

  35. Essence of JavaScript * let x = { with (x) { a: 10, a + b + 10 b: 20, } } > 40 > { a: 10, b: 20 } Not macro expressible Lambda Calculus + objects * The Essence of JavaScript (2010); Arjun Guha, Claudiu Saftoiu, and Shriram Krishnamurthi 35

  36. Thanks! (call/cc (lambda (return) (while (true) (return "Power Overwhelming!")))) 36

  37. Discussion points ● ● Expressivity as a language design Programming languages: isolated principle vs type directed language mathematical formalisms or design. complete ecosystems? ● Why is this not the prevailing way of designing languages? 37

Recommend


More recommend