Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
自作言語コンパイラを作った話
Search
Yuya Kono
September 19, 2020
Programming
0
180
自作言語コンパイラを作った話
OSC広島2020の学生LTで発表したスライドです。
https://github.com/takoeight0821/malgo
Yuya Kono
September 19, 2020
Tweet
Share
More Decks by Yuya Kono
See All by Yuya Kono
自作プログラミング言語Malgoの紹介
takoeight0821
0
200
プログラミングの暗黙知
takoeight0821
0
90
git logで振り返る大学4年間
takoeight0821
1
190
自作言語にモジュールを実装した話
takoeight0821
0
420
量子コンピュータで乱数を生成した話
takoeight0821
1
280
自作言語malgoのコンパイラをリファクタリングした話
takoeight0821
0
360
今日から始める自作コンパイラ ver 0.0.1
takoeight0821
0
1.1k
Language Server Protocolの話
takoeight0821
0
450
GraalVMで遊ぶ
takoeight0821
0
180
Other Decks in Programming
See All in Programming
Cap'n Webについて
yusukebe
0
160
CSC307 Lecture 01
javiergs
PRO
0
640
Python札幌 LT資料
t3tra
7
1.1k
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
230
大規模Cloud Native環境におけるFalcoの運用
owlinux1000
0
230
Graviton と Nitro と私
maroon1st
0
160
gunshi
kazupon
1
130
ELYZA_Findy AI Engineering Summit登壇資料_AIコーディング時代に「ちゃんと」やること_toB LLMプロダクト開発舞台裏_20251216
elyza
2
860
Basic Architectures
denyspoltorak
0
150
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
150
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
300
TerraformとStrands AgentsでAmazon Bedrock AgentCoreのSSO認証付きエージェントを量産しよう!
neruneruo
4
2.2k
Featured
See All Featured
Building Adaptive Systems
keathley
44
2.9k
Designing for humans not robots
tammielis
254
26k
New Earth Scene 8
popppiees
0
1.3k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
48
9.8k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
7.9k
エンジニアに許された特別な時間の終わり
watany
106
220k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.6k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
350
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
2k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
140
A better future with KSS
kneath
240
18k
Digital Projects Gone Horribly Wrong (And the UX Pros Who Still Save the Day) - Dean Schuster
uxyall
0
110
Transcript
ࣗ࡞ݴޠίϯύΠϥΛ࡞ͬͨ ౡࢢཱେֶɹՏ༤ ʹΌʔΜʢ!UBLPFJHIUʣ 04$ౡ 1
ࣗݾհ w ౡࢢཱେֶใՊֶ෦ใֶՊՏ༤ w ʹΌʔΜʢ!UBLPFJHIUʣ w ίϯύΠϥɺಛʹؔϓϩάϥϛϯάݴޠͷ ίϯύΠϥʹؔ৺͕͋Δ w ใॲཧֶձͷ$4ྖҬྭʢʣ
w ηΩϡϦςΟɾΩϟϯϓશࠃେձ ʢ$ίϯύΠϥࣗ࡞θϛʣ 2
.BMHPݴޠͷհ 3
ࣗ࡞ݴޠ.BMHP w .JO$BNMɺ5JHFSɺ4UBOEBSE.-Λϕʔεʹͨࣗ͠࡞ݴޠʢԶݴޠʣ w ଟ૬ؔʢδΣωϦΫεʣɺؔϦςϥϧʢແ໊ؔʣɺܕਪͳͲͷ ػೳΛͭ w .JO$BNMͱ()$ͷ࣮Λࢀߟʹɺ)BTLFMMͰ࣮ w IUUQTHJUIVCDPNUBLPFJHIUNBMHP
4
.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
.BMHPͷίϯύΠϧ ߏจղੳɹιʔείʔυΛจ๏ʹैͬͯղੳ͠ɺ"45Λग़ྗ ໊લղܾɹมએݴͱ༻ՕॴΛղੳ͠ɺͯ͢ͷมʹ࿈൪ΛৼΔ ܕݕࠪɹܕʹج͍ͮͯϓϩάϥϜΛݕࠪ͠ɺࣗ໌ͳόάΛࢦఠ ҥɹܕݕࠪͷใΛݩʹɺ.BMHPΛΑΓγϯϓϧͳதؒදݱʹม
࠷దԽɹ͍͔ͭ͘ͷ؆୯ͳ࠷దԽΛࢪ͢ ίʔυੜɹ--7.*3Λग़ྗ $MBOH 3VTU 4XJGUͱ͔ͰΘΕ͍ͯΔ ίϯύΠϥϑϨʔϜϫʔΫ 6
(SJ⒎ݴޠͷࢼΈ 7
ࣗ࡞ݴޠ(SJ⒎ w .BMHPίϯύΠϥͷίʔυੜ෦Λ࠶ར༻ͯ͠ɺ৽ͨͳݴޠॲཧܥΛ࡞Δ ࢼΈ w .BMHPͷઃܭɺ࣮ͰಘΒΕͨݟΛݩʹɺηϧϑϗετΛݟਾ࣮͑ͨ༻ ݴޠΛࢦͯ͠։ൃத w ԆධՁΛهड़͢ΔܰྔͳߏจɺύλʔϯϚονͱ༥߹ͨؔ͠Ϧςϥϧ ͳͲɺΑΓ৺తͳػೳΛऔΓࠐΜͰ͍Δ
8
(SJ⒎Ͱॻ͍ͨϓϩάϥϜ data Bool = False | True; if :: Bool
-> {a} -> {a} -> a; if c t f = c |> { True -> t! | False -> f! }; JGΛؔͱͯ͠ϢʔβʔఆٛͰ͖Δʂ 9
(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