Slide 35
Slide 35 text
Abstract Syntax Tree
Method
Resolution
in Ruby 1.9
[0] :program,
[1] [
[0] [
[0] :method_add_block,
[1] [
[0] :call,
[1] [
[0] :@int,
[1] "10",
[2] [
[0] 1,
[1] 0
]
],
[2] :".",
[3] [
[0] :@ident,
[1] "times",
[2] [
[0] 1,
[1] 3
]
]
],
[2] [
[0] :do_block,
[1] nil,
[2] [
[0] [
[0] :call,
[1] [
[0] :vcall,
[1] [
[0] :@ident,
[1] "raptor",
[2] [
[0] 2,
[1] 2
]
]
],
[2] :".",
[3] [
[0] :@ident,
[1] "rawr",
[2] [
[0] 2,
[1] 9
]
]
]
]
]
]
]
]
We can see the tokens of our original ruby in red, the result of tokenizing in light blue, and
everything added by Bison in dark blue.