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
550
「ナントカ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
The Implementations of Advanced LR Parser Algorithm
junk0612
3
1.6k
「今のプロジェクトいろいろ大変なんですよ、app/services とかもあって……」/After Kaigi on Rails 2024 LT Night
junk0612
5
2.6k
LR で JSON パーサーを作る / Coding LR JSON Parser
junk0612
2
1.4k
From LALR to IELR: A Lrama's Next Step
junk0612
2
4.3k
RubyConf Taiwan / Understanding Parser Generators surrounding Ruby with Contributing Lrama
junk0612
2
6.8k
LL法とLR法の違いは?調べてみた!-完全版-/Comparing LL and LR parse algorithm -EX Edition-
junk0612
0
1k
ESM Super LT/Comparing LL and LR parse algorithm
junk0612
1
170
Lrama へのコントリビューションを通して学ぶ Ruby のパーサジェネレータ事情
junk0612
4
7k
ソフトウェア開発とコミュニケーション / Communication in Software Development
junk0612
0
1.3k
Other Decks in Programming
See All in Programming
TVer iOSチームの共通認識の作り方 - Findy Job LT iOSアプリ開発の裏側 開発組織が向き合う課題とこれから
techtver
PRO
0
710
Feature Flag 自動お掃除のための TypeScript プログラム変換
azrsh
PRO
4
630
AIエージェントによるテストフレームワーク Arbigent
takahirom
0
270
Blueskyのプラグインを作ってみた
hakkadaikon
1
280
List Unfolding - 'unfold' as the Computational Dual of 'fold', and how 'unfold' relates to 'iterate'"
philipschwarz
PRO
0
130
try-catchを使わないエラーハンドリング!? PHPでResult型の考え方を取り入れてみよう
kajitack
3
310
JVM の仕組みを理解して PHP で実装してみよう
m3m0r7
PRO
1
250
技術的負債と戦略的に戦わざるを得ない場合のオブザーバビリティ活用術 / Leveraging Observability When Strategically Dealing with Technical Debt
yoshiyoshifujii
0
160
事業戦略を理解してソフトウェアを設計する
masuda220
PRO
4
460
從零到一:搭建你的第一個 Observability 平台
blueswen
0
220
Devinで実践する!AIエージェントと協働する開発組織の作り方
masahiro_nishimi
6
2.5k
tsconfigのオプションで変わる型世界
keisukeikeda
1
130
Featured
See All Featured
Building Adaptive Systems
keathley
41
2.6k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
25
2.8k
Designing for humans not robots
tammielis
253
25k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Rebuilding a faster, lazier Slack
samanthasiow
81
9k
GraphQLの誤解/rethinking-graphql
sonatard
71
11k
Art, The Web, and Tiny UX
lynnandtonic
298
21k
Java REST API Framework Comparison - PWX 2021
mraible
31
8.6k
Side Projects
sachag
454
42k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
6
660
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
32
2.3k
Docker and Python
trallard
44
3.4k
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