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
81
git logで振り返る大学4年間
takoeight0821
1
180
自作言語にモジュールを実装した話
takoeight0821
0
390
量子コンピュータで乱数を生成した話
takoeight0821
1
260
自作言語malgoのコンパイラをリファクタリングした話
takoeight0821
0
330
今日から始める自作コンパイラ ver 0.0.1
takoeight0821
0
1.1k
Language Server Protocolの話
takoeight0821
0
420
GraalVMで遊ぶ
takoeight0821
0
170
Other Decks in Programming
See All in Programming
SQLアンチパターン第2版 データベースプログラミングで陥りがちな失敗とその対策 / Intro to SQL Antipatterns 2nd
twada
PRO
36
11k
技術的負債で信頼性が限界だったWordPress運用をShifterで完全復活させた話
rvirus0817
0
160
대규모 트래픽을 처리하는 프론트 개발자의 전략
maryang
0
110
DMMを支える決済基盤の技術的負債にどう立ち向かうか / Addressing Technical Debt in Payment Infrastructure
yoshiyoshifujii
5
760
[DevinMeetupTokyo2025] コード書かせないDevinの使い方
takumiyoshikawa
2
250
変化を楽しむエンジニアリング ~ いままでとこれから ~
murajun1978
0
660
なぜ今、Terraformの本を書いたのか? - 著者陣に聞く!『Terraformではじめる実践IaC』登壇資料
fufuhu
4
400
MySQL9でベクトルカラム登場!PHP×AWSでのAI/類似検索はこう変わる
suguruooki
1
280
Flutterと Vibe Coding で個人開発!
hyshu
1
230
バイブスあるコーディングで ~PHP~ 便利ツールをつくるプラクティス
uzulla
1
320
Vibe Codingの幻想を超えて-生成AIを現場で使えるようにするまでの泥臭い話.ai
fumiyakume
21
10k
はじめてのWeb API体験 ー 飲食店検索アプリを作ろうー
akinko_0915
0
180
Featured
See All Featured
The Power of CSS Pseudo Elements
geoffreycrofte
77
5.9k
Connecting the Dots Between Site Speed, User Experience & Your Business [WebExpo 2025]
tammyeverts
8
420
Mobile First: as difficult as doing things right
swwweet
223
9.9k
Side Projects
sachag
455
43k
GitHub's CSS Performance
jonrohan
1031
460k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
46
7.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
21
1.4k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
7
790
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.4k
Testing 201, or: Great Expectations
jmmastey
45
7.6k
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