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
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Yuya Kono
May 19, 2019
Programming
110
1
Share
楽にコンパイラを書く話
Yuya Kono
May 19, 2019
More Decks by Yuya Kono
See All by Yuya Kono
自作プログラミング言語Malgoの紹介
takoeight0821
0
220
プログラミングの暗黙知
takoeight0821
0
110
git logで振り返る大学4年間
takoeight0821
1
210
自作言語にモジュールを実装した話
takoeight0821
0
440
量子コンピュータで乱数を生成した話
takoeight0821
1
300
自作言語コンパイラを作った話
takoeight0821
0
210
自作言語malgoのコンパイラをリファクタリングした話
takoeight0821
0
390
今日から始める自作コンパイラ ver 0.0.1
takoeight0821
0
1.1k
Language Server Protocolの話
takoeight0821
0
460
Other Decks in Programming
See All in Programming
SkillがSkillを生む:QA観点出しを自動化した
sontixyou
6
3.4k
実用!Hono RPC2026
yodaka
2
230
Claude Code × Gemini × Ebitengine ゲーム制作素人WebエンジニアがGoでゲームを作った話
webzawa
0
140
(Re)make Regexp in Ruby: Democratizing internals for the JIT
makenowjust
2
180
mruby on C#: From VM Implementation to Game Scripting (RubyKaigi 2026)
hadashia
2
520
AWSコミュニティ活動は顧客のクラウド推進に効くのか / Do AWS community activities help customers adopt the cloud?
seike460
PRO
0
140
「話せることがない」を乗り越える 〜日常業務から登壇テーマをつくる思考法〜
shoheimitani
4
810
ハンズオンで学ぶクラウドネイティブ
tatsukiminami
0
130
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
0
160
SREに優しいTerraform構成 modulesとstateの組み方
hiyanger
2
130
Liberating Ruby's Parser from Lexer Hacks
ydah
2
1.3k
CursorとClaudeCodeとCodexとOpenCodeを実際に比較してみた
terisuke
1
470
Featured
See All Featured
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.1k
A Tale of Four Properties
chriscoyier
163
24k
Abbi's Birthday
coloredviolet
2
7.1k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
500
Measuring & Analyzing Core Web Vitals
bluesmoon
9
810
How to train your dragon (web standard)
notwaldorf
97
6.6k
Done Done
chrislema
186
16k
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
490
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
25
1.9k
Measuring Dark Social's Impact On Conversion and Attribution
stephenakadiri
1
190
From π to Pie charts
rasagy
0
160
Thoughts on Productivity
jonyablonski
76
5.1k
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 Ұؾʹతݴޠʹม͢Δͱ͍͠ɻதؒදݱΛ͏·͘ ͏ͱ͙ͬͱָʹͳΔ