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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Yuya Kono
May 19, 2019
Programming
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
楽にコンパイラを書く話
Yuya Kono
May 19, 2019
More Decks by Yuya Kono
See All by Yuya Kono
自作プログラミング言語Malgoの紹介
takoeight0821
0
240
プログラミングの暗黙知
takoeight0821
0
120
git logで振り返る大学4年間
takoeight0821
1
220
自作言語にモジュールを実装した話
takoeight0821
0
460
量子コンピュータで乱数を生成した話
takoeight0821
1
310
自作言語コンパイラを作った話
takoeight0821
0
220
自作言語malgoのコンパイラをリファクタリングした話
takoeight0821
0
410
今日から始める自作コンパイラ ver 0.0.1
takoeight0821
0
1.1k
Language Server Protocolの話
takoeight0821
0
470
Other Decks in Programming
See All in Programming
AI Engineeringは、AIプロダクトだけのものか? 〜AIがソフトウェアを作る時代の新しい当たり前〜 / No AI in your product. AI Engineering in your development.
rkaga
4
360
Go言語とトイモデルで学ぶTransformerの気持ち / fukuokago23-transformer
monochromegane
0
160
GDG Korea Android: 2026 I/O Extended ~ What's new in Android development tools
pluu
0
210
Claude Opus 4.6以後の受託開発エンジニアの変化(Claude Code開発ノウハウ大公開スペシャルbyクラスメソッド)
iidatakuma
1
970
そこに3びきプロダクトがいるじゃろう——生成AI時代における“価値が届かない理由”の構造
kosuket
0
410
AIが無かった頃の素敵な出会いの話
codmoninc
1
380
「人を評価する AI」の設計と実装
ryoyanara
0
150
ビデオ通話が繋がる0.2秒で何が起きているのか
supurazako
2
170
【やさしく解説 設計編・中級 #6】良いアーキテクチャとは ~ 一本の登り道の、行き先 ~
panda728
PRO
0
210
Apache Hive: そしてCloud Native Lakehouseへ
okumin
1
200
生成AIで帳票OCRが「簡単に」作れる時代になった?
kon_shou
0
420
Foundation Models frameworkで画像分析
ryodeveloper
1
510
Featured
See All Featured
Everyday Curiosity
cassininazir
0
270
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.5k
Navigating Weather and Climate Data
rabernat
0
450
The browser strikes back
jonoalderson
0
1.4k
Discover your Explorer Soul
emna__ayadi
2
1.2k
Balancing Empowerment & Direction
lara
6
1.2k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
Making Projects Easy
brettharned
120
6.7k
[RailsConf 2023 Opening Keynote] The Magic of Rails
eileencodes
31
10k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.5k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
72
41k
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Transcript
ָʹίϯύΠϥΛॻ͘ ʹΌʔΜʢ!UBLPFJHIUʣ
ϓϩάϥϛϯάݴޠ ࡞ͬͯ·͢
ࣗ࡞ݴޠ͋Δ͋Δ Α͋͘Δޡղฤ ͍͘͢͜͝͠ͱΛ͍ͯ͠ΔͱࢥΘΕΔ ಄͕͓͔͍͠ਓͩͱࢥΘΕΔ 3VCZ͖ͩͱࢥΘΕΔ
ࣗ࡞ݴޠ͋Δ͋Δ Α͋͘Δޡղฤ ͍͘͢͜͝͠ͱΛ͍ͯ͠ΔͱࢥΘΕΔ ಄͕͓͔͍͠ਓͩͱࢥΘΕΔ 3VCZ͖ͩͱࢥΘΕΔ ਖ਼͍͠ͷ͚ͩ ͍͘͢͝͠Θ͚Ͱͳ͍
ίϯύΠϥͱ w ݴޠ"͔Βݴޠ#ͷมϓϩάϥϜ w #ΞηϯϒϦݴޠωΠςΟϒίϯύΠϥ w "#ͷͭ͋Δɻ#BCFMͱ͔ w ෳͷมॲཧΛ࿈݁ͨ͠ͷ͕΄ͱΜͲ w
ιʔείʔυΛநߏจʹม w நߏจΛதؒදݱʹม w தؒදݱΛతίʔυʹม
ίϯύΠϥͷ͠͞ w ιʔείʔυͱతίʔυͷΪϟοϓ͕େ͖͍΄Ͳ͍͠ w $ ˠΞηϯϒϦݴޠ͍͠ w ࠷దԽίϯύΠϥ͍͠ w ߴڃݴޠͷίϯύΠϥΘΓͱ؆୯
ྫ w ύλʔϯϚον͕͋Δݴޠ͔Β$ʹม͢ΔίϯύΠϥ w $ʹม͢Εɺ࠷దԽͱ͔$ίϯύΠϥ͕ؤுͬͯ ͘ΕΔ
ύλʔϯϚονͬͯʁ type Result = Ok(int) | Err(string) match input {
Ok(value) => return value, Err(_) => error("something bad happend"), } ͜Μͳͷɻ ༩͑ΒΕͨ JOQVU ͷܗʹԠͯ͡ذ͢Δɻ 3FTVMUͷఆٛ$ʹม͠ͳ͍ͱ͍͚ͳ͍ɻ
࡞ઓ w ܕλά͖ڞ༻ମʹม͢Δ w 0Lˠ &SSˠͰλά͚͢Δ w NBUDINBUDI@UBHʹม͢Δ
ܕͷม struct Result { int tag; union { int val_0;
string val_1; }; } int Ok = 0; int Err = 1; ܕ$ʹมͰ͖ͨɻ
NBUDI@UBHʹม match_tag (input, Ok) { value = input.val_0; return value;
} else match_tag (input, Err) { _ = input.val_1; error("something bad happend"); } NBUDI@UBHୈҰҾͷUBH͕ୈೋҾʹ͚͠Εଓ͘ ϒϩοΫΛ࣮ߦ͢ΔɻJGͷѥछɻ
$ʹม struct Result { int tag; union { int val_0;
char* val_1; } }; int Ok = 0; int Err = 1; if (input.tag == Ok) { int value = input.val_0; return value; } else if (input.tag == Err) { error("something bad happened"); }
·ͱΊ w ίϯύΠϥݴޠ"͔Βݴޠ#ͷมϓϩάϥϜ w Ұؾʹతݴޠʹม͢Δͱ͍͠ɻதؒදݱΛ͏·͘ ͏ͱ͙ͬͱָʹͳΔ