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
370
今日から始める自作コンパイラ 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
TestingOsaka6_Ozono
o3
0
260
gunshi
kazupon
1
130
Cap'n Webについて
yusukebe
0
160
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
330
AI前提で考えるiOSアプリのモダナイズ設計
yuukiw00w
0
210
The Art of Re-Architecture - Droidcon India 2025
siddroid
0
150
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
580
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
160
ThorVG Viewer In VS Code
nors
0
500
20251212 AI 時代的 Legacy Code 營救術 2025 WebConf
mouson
0
240
Navigating Dependency Injection with Metro
l2hyunwoo
1
200
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
180
Featured
See All Featured
Bootstrapping a Software Product
garrettdimon
PRO
307
120k
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
The World Runs on Bad Software
bkeepers
PRO
72
12k
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
61
51k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
141
34k
Skip the Path - Find Your Career Trail
mkilby
0
29
GraphQLとの向き合い方2022年版
quramy
50
14k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Highjacked: Video Game Concept Design
rkendrick25
PRO
0
260
The Mindset for Success: Future Career Progression
greggifford
PRO
0
200
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
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