Grammar a BNF like Ruby DSL Parsing
summary
A Ruby DSL represents grammars as plain objects and an engine generates parsers (an interpreter called ruby0, a Ruby code generator and a C-compiled generator), claiming near-C speed when compiled and a roughly 5x speedup since v0.5; the pure-Ruby generator already outperforms a Racc C extension. It supports left recursion (converted to loops), a backtrack mode for unlimited lookahead, producer/consumer pipes for threaded lexer→parser chains, variables for context‑sensitive parsing, streaming of gigabyte inputs when no AST is retained, and action blocks that generate code via method_missing and bracket wrappers.
AI-written summary · about
chapters (9)
- 0:00Start
- 3:38Grammar Engine
- 4:17Regular Expressions
- 5:45Input Sequence
- 13:00Ll Parser
- 14:08Recursion
- 14:20Recursive Grammar
- 15:43Left Recursion
- 28:26A Performance Analysis of Several Parsers
related talks
32mParsing Ruby
52mTreetop: Syntactic Analysis with Ruby
43mGrammars, Parsers, and Interpreters, In Ruby
29mHow does Lrama make the Ruby parser grammar G.O.A.T.?
31mTime flies like an arrow, fruit flies like a banana
32mTime flies like an arrow; Fruit flies like a banana: Parsers for Great Good
38mDSLs, Code Generation, and New Domains for Ruby
37mRuby ate my DSL!
