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

自作言語進捗 2019 May / ojaml-2019-may

自作言語進捗 2019 May / ojaml-2019-may

todesking

May 28, 2019
Tweet

More Decks by todesking

Other Decks in Technology

Transcript

  1. ͋Β͢͡ • 1݄͝Ζ͔Βࣗ࡞ݴޠΛ࡞Γ࢝ΊͨͷͰɺͨ·ʹਐḿΛใ ࠂ͠Α͏ͱࢥ͍·͢…… • લճͷ͋Β͢͡: https://speakerdeck.com/todesking/zi- zuo-yan-yu-jin-bu-2019-mar • ಈػ

    • Ұ෦ͰCίϯύΠϥࣗ࡞͕ྲྀߦͬͯͨ • ܕγεςϜͷ࣮ݧ͕͍ͨ͠ • JVMͰಈ͘MLܥݴޠΛ࡞͍ͬͯ·͢ • ηϧϑϗεςΟϯά΋໨ඪͱ͢Δ • https://github.com/todesking/ojaml
  2. ਐḿ Ϟδϡʔϧ Ϟδϡʔϧม਺ ؔ਺ ϩʔΧϧม਺(let/let rec) جຊతͳ੔਺ԋࢉ ݪ࢝తͳܕਪ࿦ Java FFI

    ADT ·ͱ΋ͳܕਪ࿦(HM) ύϥϝτϦοΫଟ૬ letଟ૬ REPL Refinement types ηϧϑϗεςΟϯά
  3. ܕਪ࿦ • ܕม਺͕ै͏΂੍͖໿ΛٻΊΔ let +: int -> int -> int;;

    let add: T1 = (fun x: T2 => (fun y: T3 => (x + y): T4 ): T5 ): T6 ;; T1 = T6 T6 = T2 -> T5 T5 = T3 -> T4 T4 = int T2 = int T3 = int
  4. ܕਪ࿦ • ੍໿ͷղΛٻΊΔ T1 = T6 T6 = T2 ->

    T5 T5 = T3 -> T4 T4 = int T2 = int T3 = int T1 = T2 -> T5 T6 = T2 -> T5 T5 = T3 -> T4 T4 = int T2 = int T3 = int T1 = T2 -> T3 -> T4 T6 = T2 -> T3 -> T4 T5 = T3 -> T4 T4 = int T2 = int T3 = int
  5. REPL • JVMϕʔεݴޠͳͷͰͱͯ΋ָͩͬͨ • ͦΕ·Ͱʹఆٛ͞Εͨม਺Λimport͓ͯ͘͠ • ೖྗΛϞδϡʔϧʹม׵ͯ͠ίϯύΠϧ͢Δ REPL:1> 1 +

    1 module Repl_1 { let res1 = 1 + 1 ;; } REPL:2> let x = res1 ;; import Repl_1.res1 module Repl_2 { let x = res1 ;; } REPL:3> x + 1 ;; import Repl_1.res1 import Repl_2.x module Repl_3 { let res3 = x + 1 ;; }