~/talk

Treetop: Syntactic Analysis with Ruby

Talkat RubyConf 2007 · 2007-11-02..11-04· [ruby]
slides:none on file

Treetop presents a Ruby grammar engine that uses parsing expression grammars and packrat parsing so code parses without a separate lexer, trading memory for simpler composition. The demo builds an arithmetic parser and a 132-line interpreter for an extended lambda calculus, with unit tests showing the rules evaluate correctly and composition via modules working. Implementation compiles grammars to Ruby modules, instantiates syntax node objects, and accepts the cost of object allocation for clearer, reusable grammars under Treetop.

AI-written summary · about

  1. 0:00Start
  2. 4:52What Is a Context-Free Grammar
  3. 6:45Context-Free Grammar
  4. 7:58Context-Free Generative Grammar
  5. 8:37Dangling Else Problem
  6. 9:41Parsing Expression Grammars
  7. 12:00Pumping Lemma
  8. 13:31Load Grammar Declaration
  9. 15:44Custom Subclass of Syntax Node
  10. 17:38Parse the Language of Arithmetic
  11. 19:28Defining the Arithmetic Grammar
  12. 21:30Test Variables
  13. 23:39Multiplication
  14. 29:35Change the Operator
  15. 31:22Parentheses That Override the Operator Precedence
  16. 34:12Packrat Parsing
  17. 35:59Lambda Calculus
  18. 37:25Source Code of the Lambda Calculus Interpreter
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.