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
「ナントカLR」を整理する / Clarifying LR Algorithms
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Junichi Kobayashi
June 25, 2024
Programming
1
650
「ナントカLR」を整理する / Clarifying LR Algorithms
After RubyKaigi 2024 LR Parser Night w/ Asakusa.rb
Junichi Kobayashi
June 25, 2024
Tweet
Share
More Decks by Junichi Kobayashi
See All by Junichi Kobayashi
rage against annotate_predecessor
junk0612
0
220
The Implementations of Advanced LR Parser Algorithm
junk0612
3
2.4k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
6
2.8k
LR で JSON パーサーを作る / Coding LR JSON Parser
junk0612
2
1.7k
From LALR to IELR: A Lrama's Next Step
junk0612
2
4.7k
RubyConf Taiwan / Understanding Parser Generators surrounding Ruby with Contributing Lrama
junk0612
2
7k
LL法とLR法の違いは?調べてみた!-完全版-/Comparing LL and LR parse algorithm -EX Edition-
junk0612
0
1.5k
ESM Super LT/Comparing LL and LR parse algorithm
junk0612
1
210
Lrama へのコントリビューションを通して学ぶ Ruby のパーサジェネレータ事情
junk0612
4
7.2k
Other Decks in Programming
See All in Programming
MUSUBIXとは
nahisaho
0
130
humanlayerのブログから学ぶ、良いCLAUDE.mdの書き方
tsukamoto1783
0
190
2026年 エンジニアリング自己学習法
yumechi
0
130
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
400
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
450
AIエージェント、”どう作るか”で差は出るか? / AI Agents: Does the "How" Make a Difference?
rkaga
4
2k
Basic Architectures
denyspoltorak
0
670
CSC307 Lecture 09
javiergs
PRO
1
830
生成AIを使ったコードレビューで定性的に品質カバー
chiilog
1
260
Patterns of Patterns
denyspoltorak
0
1.4k
余白を設計しフロントエンド開発を 加速させる
tsukuha
7
2.1k
Grafana:建立系統全知視角的捷徑
blueswen
0
330
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1k
Agile that works and the tools we love
rasmusluckow
331
21k
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.7k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
99
Docker and Python
trallard
47
3.7k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
300
Measuring & Analyzing Core Web Vitals
bluesmoon
9
750
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
A Guide to Academic Writing Using Generative AI - A Workshop
ks91
PRO
0
200
Music & Morning Musume
bryan
47
7.1k
Raft: Consensus for Rubyists
vanstee
141
7.3k
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
140
Transcript
「ナントカLR」を整理する Junichi Kobayashi (@junk0612) ESM, Inc. LR Parser Night w/
Asakusa.rb ANDPAD Inc. 2024/06/25(Tue.)
Junichi Kobayashi • X / GitHub: @junk0612 • 永和システムマネジメント ◦
Rails エンジニア ◦ 構文解析器研究部員 • 趣味 ◦ パーサー ◦ 音楽ゲーム ◦ ボードゲーム ◦ 俳句
We Are Hiring!! 詳しくは社員まで ☺
大事なことは最初に
「From LALR to IELR」 相関図 Canonical LR 定義に基づく実装 処理能力が高い LALR
現実的なメモリ使用量 最も実用的 IELR 最小 LR の一種 Lrama に実装中 ときどきあるミスが気になる 効率の悪さを直してほしい いいとこ取りを狙う Parser Scannerless Parser 依存 不満 PSLR Lexer 統合のための武器 Lrama が目指すもの
IELR 最小 LR の一種 Lrama に実装中 効率の悪さを直してほしい いいとこ取りを狙う Scannerless Parser
依存 不満 PSLR Lexer 統合のための武器 Lrama が目指すもの Canonical LR 定義に基づく実装 処理能力が高い LALR 現実的なメモリ使用量 最も実用的 「From LALR to IELR」 相関図 ときどきあるミスが気になる Parser Mysterious Conflict
「From LALR to IELR」 相関図 IELR 最小 LR の一種 Lrama
に実装中 ときどきあるミスが気になる いいとこ取りを狙う Scannerless Parser 依存 不満 PSLR Lexer 統合のための武器 Lrama が目指すもの Canonical LR 定義に基づく実装 処理能力が高い LALR 現実的なメモリ使用量 最も実用的 効率の悪さを直してほしい Parser 状態数 (≒メモリ使用量) 5~10倍 (論文より)
「From LALR to IELR」 相関図 ときどきあるミスが気になる 効率の悪さを直してほしい Scannerless Parser 依存
不満 PSLR Lexer 統合のための武器 Lrama が目指すもの Canonical LR 定義に基づく実装 処理能力が高い LALR 現実的なメモリ使用量 最も実用的 IELR 最小 LR の一種 Lrama に実装中 いいとこ取りを狙う Parser どんな入力でも 同じ動作 状態数は ほぼ同じ
「From LALR to IELR」 相関図 Canonical LR 定義に基づく実装 処理能力が高い LALR
現実的なメモリ使用量 最も実用的 IELR 最小 LR の一種 Lrama に実装中 ときどきあるミスが気になる 効率の悪さを直してほしい いいとこ取りを狙う Parser Scannerless Parser 依存 不満 PSLR Lexer 統合のための武器 Lrama が目指すもの
ときどきあるミスが気になる 効率の悪さを直してほしい いいとこ取りを狙う Scannerless Parser 依存 不満 PSLR Lexer 統合のための武器
Lrama が目指すもの 「From LALR to IELR」 相関図 Canonical LR 定義に基づく実装 処理能力が高い LALR 現実的なメモリ使用量 最も実用的 IELR 最小 LR の一種 Lrama に実装中 Parser
Parser State 0 State 1 State 2 State 3 NUM
+ exp State 4 State 5 State 6 * ( exp NUM - … Token Stream Source Code Lexer Grammar File Parser Generator 8, 'B' 4, '-' 1, 'E' 0 LR Parser のイメージモデル
Parser State 0 State 1 State 2 State 3 NUM
+ exp State 4 State 5 State 6 * ( exp NUM - … Token Stream Source Code Lexer Grammar File Parser Generator 8, 'B' 4, '-' 1, 'E' 0 LR Parser のイメージモデル オートマトンを どう作るかの違い
Canonical LR のオートマトン
Canonical LR のオートマトン
LALR のオートマトン
LALR のオートマトン
IELR のオートマトン
「From LALR to IELR」 相関図 Canonical LR 定義に基づく実装 処理能力が高い LALR
現実的なメモリ使用量 最も実用的 IELR 最小 LR の一種 Lrama に実装中 ときどきあるミスが気になる 効率の悪さを直してほしい いいとこ取りを狙う Parser Scannerless Parser 依存 不満 PSLR Lexer 統合のための武器 Lrama が目指すもの
付録: Mysterious Conflict
Mysterious New Conflict
Mysterious Invasive Conflict
Mysterious Mutated Conflict