Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Compiling a Dependently Typed Language to Ruby

Compiling a Dependently Typed Language to Ruby

A.K.A. "Compilers Are Dope And Also A Little Bit About Fancy Types"

Michael Bernstein

June 12, 2015
Tweet

More Decks by Michael Bernstein

Other Decks in Programming

Transcript

  1. Compiling A
    Dependently Typed
    Language To Ruby
    Michael R. Bernstein
    RubyNation / 2015.6.12 / Silver Spring, Maryland

    View full-size slide

  2. New ways of looking at how
    programs are designed,
    written,
    executed,
    optimized,
    refactored,
    etc.

    View full-size slide

  3. Compilers Are Dope
    And Also A Little Bit
    About Fancy Types
    Michael R. Bernstein
    RubyNation / 2015.6.12 / Silver Spring, Maryland

    View full-size slide

  4. Very Interesting

    View full-size slide

  5. Compiler:
    - a computer program
    - that consumes computer programs
    - and produces computer programs

    View full-size slide

  6. Compiler:
    - a computer program
    - that does whatever you want

    View full-size slide

  7. [Animated image
    representing the
    sheer awesomeness
    of COMPILERS]

    View full-size slide

  8. “Modern Compiler
    Implementation in ML”
    Appel

    View full-size slide

  9. Idris Ruby
    ????

    View full-size slide

  10. Idris Ruby
    Rainbows,
    wizard dust,
    prayers,
    mystical insights,
    etc.

    View full-size slide

  11. Intermediate Representations

    View full-size slide

  12. Idris Ruby
    ????

    View full-size slide

  13. LAMBDA CALCULUS

    View full-size slide

  14. Everything that is computable
    can be expressed in terms
    of the lambda calculus.

    View full-size slide

  15. Everything that is computable
    can be compiled to the
    lambda calculus.

    View full-size slide

  16. Intermediate Representations
    Intermediate Representations
    Intermediate Representations
    Intermediate Representations
    Intermediate Representations
    Intermediate Representations

    View full-size slide

  17. TT
    TT Case
    IR Case
    IR Lift
    IR Defunc
    IR ANF
    Idris ???

    View full-size slide

  18. TT
    TT Case
    IR Case
    IR Lift
    IR Defunc
    IR ANF
    Idris PHP

    View full-size slide

  19. Tour and Demo!

    View full-size slide

  20. Type Systems

    View full-size slide

  21. [Animated image
    representing the
    sheer awesomeness of
    TYPE SYSTEMS]

    View full-size slide

  22. Dependent Types

    View full-size slide

  23. Expressive Types

    View full-size slide

  24. pythag : Int -> List (Int, Int, Int)
    counter_rpc : Int -> Maybe Int ->
    Process (Maybe Int) (Int,Int)

    View full-size slide

  25. Program Phases

    View full-size slide

  26. Syntax Check
    Compile
    Execute
    Test
    Type Check
    Write

    View full-size slide

  27. Syntax Check
    Compile
    Execute
    Test
    Type Check
    Write

    View full-size slide

  28. Syntax Check
    Compile
    Execute
    Test
    Type Check
    Write

    View full-size slide

  29. More People To Read

    View full-size slide

  30. Stephanie Weirich

    View full-size slide

  31. Conor McBride

    View full-size slide

  32. Philip Wadler

    View full-size slide

  33. Sam Elliot, Edwin Brady,
    #idris, RubyNation & you!
    Acknowledgements

    View full-size slide

  34. Thank You
    w michaelrbernste.in
    t @mrb_bk

    View full-size slide