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

自作言語コンパイラを作った話

Yuya Kono
September 19, 2020

 自作言語コンパイラを作った話

OSC広島2020の学生LTで発表したスライドです。
https://github.com/takoeight0821/malgo

Yuya Kono

September 19, 2020
Tweet

More Decks by Yuya Kono

Other Decks in Programming

Transcript

  1. .BMHPͰॻ͍ͨϑΟϘφον਺ܭࢉϓϩάϥϜ let extern print_int : Int -> {} = "print_int"

    in let extern newline : () -> {} = "newline" in let fun fib(n) : Int = if n <= 1 then 1 else fib(n - 1) + fib(n - 2) in print_int(fib(10)); newline() 5
  2. (SJ⒎Ͱॻ͍ͨϓϩάϥϜ data Bool = False | True; if :: Bool

    -> {a} -> {a} -> a; if c t f = c |> { True -> t! | False -> f! }; JGΛؔ਺ͱͯ͠ϢʔβʔఆٛͰ͖Δʂ 9
  3. (SJ⒎Ͱॻ͍ͨϓϩάϥϜ data List a = Nil | Cons a (List

    a); sum = { Nil -> Int# 0L# | (Cons (Int# x) xs) -> sum xs |> {(Int# s) -> Int# (x +# s)} } ύλʔϯϚονͱ༥߹ͨؔ͠਺Ϧςϥϧ  ͢΂ͯ୤౶ҥͨ͠.BMHPʹม׵͞ΕΔ 10