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
Junichi Kobayashi
June 25, 2024
Programming
1
640
「ナントカ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
210
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
CSC307 Lecture 04
javiergs
PRO
0
650
今から始めるClaude Code超入門
448jp
2
770
組織で育むオブザーバビリティ
ryota_hnk
0
150
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
130
実は歴史的なアップデートだと思う AWS Interconnect - multicloud
maroon1st
0
360
なぜSQLはAIぽく見えるのか/why does SQL look AI like
florets1
0
400
CSC307 Lecture 02
javiergs
PRO
1
770
CSC307 Lecture 07
javiergs
PRO
0
520
Patterns of Patterns
denyspoltorak
0
1.3k
ZJIT: The Ruby 4 JIT Compiler / Ruby Release 30th Anniversary Party
k0kubun
1
390
AI Agent の開発と運用を支える Durable Execution #AgentsInProd
izumin5210
7
2.2k
2026年 エンジニアリング自己学習法
yumechi
0
110
Featured
See All Featured
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
49
9.8k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
110
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Building Applications with DynamoDB
mza
96
6.9k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
230
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
0
130
Building Better People: How to give real-time feedback that sticks.
wjessup
370
20k
Faster Mobile Websites
deanohume
310
31k
Testing 201, or: Great Expectations
jmmastey
46
8k
A Modern Web Designer's Workflow
chriscoyier
698
190k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
420
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
240
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