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
160
自作言語コンパイラを作った話
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
180
プログラミングの暗黙知
takoeight0821
0
79
git logで振り返る大学4年間
takoeight0821
1
170
自作言語にモジュールを実装した話
takoeight0821
0
380
量子コンピュータで乱数を生成した話
takoeight0821
1
250
自作言語malgoのコンパイラをリファクタリングした話
takoeight0821
0
330
今日から始める自作コンパイラ ver 0.0.1
takoeight0821
0
1.1k
Language Server Protocolの話
takoeight0821
0
420
GraalVMで遊ぶ
takoeight0821
0
160
Other Decks in Programming
See All in Programming
セキュリティマネジャー廃止とクラウドネイティブ型サンドボックス活用
kazumura
1
190
社内での開発コミュニティ活動とモジュラーモノリス標準化事例のご紹介/xPalette and Introduction of Modular monolith standardization
m4maruyama
1
130
コードの90%をAIが書く世界で何が待っているのか / What awaits us in a world where 90% of the code is written by AI
rkaga
41
27k
GraphRAGの仕組みまるわかり
tosuri13
7
450
事業戦略を理解してソフトウェアを設計する
masuda220
PRO
22
6.2k
DroidKnights 2025 - 다양한 스크롤 뷰에서의 영상 재생
gaeun5744
3
300
コード書くの好きな人向けAIコーディング活用tips #orestudy
77web
3
320
関数型まつり2025登壇資料「関数プログラミングと再帰」
taisontsukada
2
840
A comprehensive view of refactoring
marabesi
0
970
從零到一:搭建你的第一個 Observability 平台
blueswen
1
960
地方に住むエンジニアの残酷な現実とキャリア論
ichimichi
2
570
Cursor AI Agentと伴走する アプリケーションの高速リプレイス
daisuketakeda
1
120
Featured
See All Featured
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
15
1.5k
Imperfection Machines: The Place of Print at Facebook
scottboms
267
13k
BBQ
matthewcrist
89
9.7k
Testing 201, or: Great Expectations
jmmastey
42
7.5k
The Language of Interfaces
destraynor
158
25k
Being A Developer After 40
akosma
90
590k
Build your cross-platform service in a week with App Engine
jlugia
231
18k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.8k
The World Runs on Bad Software
bkeepers
PRO
68
11k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
32
5.9k
Done Done
chrislema
184
16k
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