Does Ruby Parser dream of highly expressive grammar?
summary
Proposes extending Ruby’s parser grammar by adding parameterized rules and a small standard library to reduce duplication, using Lrama (a Ruby LALR parser generator that emits C) and borrowing ideas from Menhir; demonstrates optional tag typing, a conditional %if for rule inclusion (prototype, not finalized), and an inlining feature that resolves shift/reduce conflicts without changing grammar shape. Changes already land in Ruby 3.3.0 for some features; inlining currently rewrites action code and needs an intermediate-language redesign.
AI-written summary · about
chapters (7)
- 0:00Introduction and speaker intro
- 2:35Current parser challenges
- 5:24Extending grammar with parameterized rules
- 14:48Tight lexer-parser coupling
- 19:49Conflict resolution with inlining
- 23:22Conclusion and future work
- 24:26Acknowledgments and thanks
related talks
29mHow does Lrama make the Ruby parser grammar G.O.A.T.?
46mGrammar a BNF like Ruby DSL Parsing
32mParsing Ruby
33mRuby: A Family History
43mGrammars, Parsers, and Interpreters, In Ruby
52mTreetop: Syntactic Analysis with Ruby
26mLiberating Ruby's Parser from Lexer Hacks
40mThe Future of Understanding Ruby Code
