Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ruby Ruby

Ruby Ruby

Yo dawg, I heard you like Ruby, so I wrote Ruby in Ruby so you can run Ruby while you run Ruby.

Avatar for Danielle Smith

Danielle Smith

February 07, 2020
Tweet

More Decks by Danielle Smith

Other Decks in Programming

Transcript

  1. YO DAWG, I HEARD YOU LIKE RUBY SO I WROTE

    RUBY IN RUBY SO YOU CAN RUN RUBY WHILE YOU RUN RUBY
  2. AST DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo def foo(a, b) a + b end
  3. AST DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b def foo(a, b) a + b end
  4. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo opt_send :define_method, argc: 2 leave == ISeq:foo local table (size: 2, argc: 2) [ 2] a@0<Arg> [ 1] b@1<Arg> getlocal a@0 getlocal b@1 opt_plus :+, argc: 1 leave
  5. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> argc: 1 leave
  6. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave
  7. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave == ISeq:foo
  8. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave == ISeq:foo local table (size: 2, argc: 2) [ 2] a@0<Arg> [ 1] b@1<Arg>
  9. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave == ISeq:foo local table (size: 2, argc: 2) [ 2] a@0<Arg> [ 1] b@1<Arg> getlocal a@0
  10. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave == ISeq:foo local table (size: 2, argc: 2) [ 2] a@0<Arg> [ 1] b@1<Arg> getlocal a@0 getlocal b@1
  11. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave == ISeq:foo local table (size: 2, argc: 2) [ 2] a@0<Arg> [ 1] b@1<Arg> getlocal a@0 getlocal b@1 send :+, argc: 1
  12. Instructions DEFN ARGS BLOCK OPCALL LVAR [:a, :b] :+ :a

    :foo LVAR :b == ISeq:<main> putobject :foo putiseq foo send :define_method, argc: 2 leave == ISeq:foo local table (size: 2, argc: 2) [ 2] a@0<Arg> [ 1] b@1<Arg> getlocal a@0 getlocal b@1 send :+, argc: 1 leave
  13. Enter: Ruby Parser Pure-Ruby LALR(1) parser using racc. (yacc but

    Ruby instead of C) (a derivative of bison)
  14. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  15. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  16. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  17. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  18. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  19. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  20. s-expressions def foo(a, b) a + b end s(:defn, :foo,

    s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  21. Iseq:<main> local table: {} ISEQs s(:defn, :foo, s(:args, :a, :b),

    s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  22. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  23. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return Iseq:foo ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  24. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return Iseq:foo local table: {a: [:arg], b: [:arg]} ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  25. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return Iseq:foo local table: {a: [:arg], b: [:arg]} 0: getlocal a,0 ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  26. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return Iseq:foo local table: {a: [:arg], b: [:arg]} 0: getlocal a,0 1: getlocal b,0 ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  27. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return Iseq:foo local table: {a: [:arg], b: [:arg]} 0: getlocal a,0 1: getlocal b,0 2: send :+, argc:1 ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  28. Iseq:<main> local table: {} 0: putobject :foo 1: putiseq foo

    2: define_method 3: leave return Iseq:foo local table: {a: [:arg], b: [:arg]} 0: getlocal a,0 1: getlocal b,0 2: send :+, argc:1 3: leave return ISEQs s(:defn, :foo, s(:args, :a, :b), s(:call, s(:lvar, :a), :+, s(:lvar, :b)))
  29. def foo 10.times do |i| puts i end end <main>

    -> foo Control Frame “Chain”
  30. def foo 10.times do |i| puts i end end <main>

    -> foo -> Integer#times Control Frame “Chain”
  31. def foo 10.times do |i| puts i end end <main>

    -> foo -> Integer#times -> block in foo Control Frame “Chain”
  32. def foo 10.times do |i| puts i end end <main>

    -> foo -> Integer#times -> block in foo -> puts Control Frame “Chain”
  33. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  34. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  35. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  36. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  37. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  38. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  39. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave
  40. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 00 OUTPUT:
  41. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 01 OUTPUT:
  42. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 02 OUTPUT: Hello
  43. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 03 OUTPUT: Hello
  44. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 04 OUTPUT: Hello World
  45. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 05 OUTPUT: Hello World
  46. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 06 OUTPUT: Hello World How
  47. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 07 OUTPUT: Hello World How
  48. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 08 OUTPUT: Hello World How Are
  49. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 09 OUTPUT: Hello World How Are
  50. puts "Hello" puts "World" puts "How" puts "Are" puts "You?"

    00 putstring "Hello" 01 send :puts 02 putstring "World" 03 send :puts 04 putstring "How" 05 send :puts 06 putstring "Are" 07 send :puts 08 putstring "You?" 09 send :puts 10 leave PC: 10 OUTPUT: Hello World How Are You?
  51. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave
  52. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave
  53. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave
  54. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave
  55. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave
  56. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 00 OUTPUT:
  57. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 00 OUTPUT: The Stack! 00 01 02 03 04
  58. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 00 SP: 00 OUTPUT: The Stack! 00 01 02 03 04
  59. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 01 SP: 01 OUTPUT: The Stack! 00 main 01 02 03 04
  60. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 02 SP: 02 OUTPUT: The Stack! 00 main 01 2 02 03 04
  61. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 03 SP: 03 OUTPUT: The Stack! 00 main 01 2 02 7 03 04
  62. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 04 SP: 04 OUTPUT: The Stack! 00 main 01 2 02 7 03 3 04
  63. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 04 SP: 03 OUTPUT: The Stack! 00 main 01 2 02 7 03 04
  64. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 04 SP: 02 OUTPUT: The Stack! 00 main 01 2 02 03 04
  65. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 05 SP: 03 OUTPUT: The Stack! 00 main 01 2 02 10 03 04
  66. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 06 SP: 04 OUTPUT: The Stack! 00 main 01 2 02 10 03 4 04
  67. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 07 SP: 03 OUTPUT: The Stack! 00 main 01 2 02 40 03 04
  68. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 08 SP: 02 OUTPUT: The Stack! 00 main 01 42 02 03 04
  69. puts 2 + (7 + 3) * 4 00 putself

    01 putobject 2 02 putobject 7 03 putobject 3 04 send :+ 05 putobject 4 06 send :* 07 send :+ 08 send :puts 09 leave PC: 09 SP: 00 OUTPUT: 42 The Stack! 00 01 02 03 04
  70. klass: RClass flags: [] RBasic ivars: {} RObject RString, RArray,

    RHash, etc. Integer, Float, Symbol, etc. “primitives”
  71. klass: RClass flags: [] RBasic ivars: {} RObject RClass RString,

    RArray, RHash, etc. Integer, Float, Symbol, etc. “primitives”
  72. klass: RClass flags: [] RBasic ivars: {} RObject RClass super:

    RClass RString, RArray, RHash, etc. Integer, Float, Symbol, etc. “primitives”
  73. klass: RClass flags: [] RBasic ivars: {} RObject RClass super:

    RClass constants: {} RString, RArray, RHash, etc. Integer, Float, Symbol, etc. “primitives”
  74. klass: RClass flags: [] RBasic ivars: {} RObject RClass super:

    RClass constants: {} methods: {} RString, RArray, RHash, etc. Integer, Float, Symbol, etc. “primitives”
  75. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class]
  76. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class] methods: { }
  77. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class] methods: { :foo }
  78. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class] methods: { :foo => iseq_method }
  79. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class] methods: { :foo => iseq_method } constants: { }
  80. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class] methods: { :foo => iseq_method } constants: { :X }
  81. class A X = 1 def foo “FOO!” end end

    A: RClass super: Object flags: [:class] methods: { :foo => iseq_method } constants: { :X => 1 }
  82. class A end class B < A end A: RClass

    super: Object B: RClass
  83. class A end class B < A end A: RClass

    super: Object B: RClass super:
  84. class A end class B < A end A: RClass

    super: Object B: RClass super: A
  85. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module]
  86. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo}
  87. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass
  88. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object
  89. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass
  90. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: Object
  91. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: Object flags: [:iclass]
  92. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: Object flags: [:iclass] methods:
  93. module M def foo; end end class A include M

    end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: M_copy M_copy: RClass super: Object flags: [:iclass] methods:
  94. module M def foo; end end module N def bar;

    end end class A include M include N end
  95. module M def foo; end end module N def bar;

    end end class A include M include N end
  96. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo}
  97. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} N: RClass super: nil flags: [:module] methods: {:bar}
  98. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object N: RClass super: nil flags: [:module] methods: {:bar}
  99. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass N: RClass super: nil flags: [:module] methods: {:bar}
  100. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: Object flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar}
  101. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: M_copy M_copy: RClass super: Object flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar}
  102. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: M_copy M_copy: RClass super: Object flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar} N_copy: RClass
  103. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: M_copy M_copy: RClass super: Object flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar} N_copy: RClass super: flags: [:iclass] methods:
  104. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: M_copy M_copy: RClass super: Object flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar} N_copy: RClass super: M_copy flags: [:iclass] methods:
  105. module M def foo; end end module N def bar;

    end end class A include M include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: N_copy M_copy: RClass super: Object flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar} N_copy: RClass super: M_copy flags: [:iclass] methods:
  106. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo}
  107. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} N: RClass super: nil flags: [:module] methods: {:bar}
  108. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object N: RClass super: nil flags: [:module] methods: {:bar}
  109. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass N: RClass super: nil flags: [:module] methods: {:bar}
  110. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: nil flags: [:module] methods: {:bar}
  111. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar}
  112. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar} N_copy: RClass
  113. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar} N_copy: RClass super: nil flags: [:iclass] methods:
  114. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar} N_copy: RClass super: nil flags: [:iclass] methods: M_copy2: RClass
  115. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar} N_copy: RClass super: nil flags: [:iclass] methods: M_copy2: RClass super: Object flags: [:iclass] methods:
  116. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: Object M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar} N_copy: RClass super: M_copy2 flags: [:iclass] methods: M_copy2: RClass super: Object flags: [:iclass] methods:
  117. module M def foo; end end module N include M

    end class A include N end M: RClass super: nil flags: [:module] methods: {:foo} A: RClass super: N_copy M_copy: RClass super: nil flags: [:iclass] methods: N: RClass super: M_copy flags: [:module] methods: {:bar} N_copy: RClass super: M_copy2 flags: [:iclass] methods: M_copy2: RClass super: Object flags: [:iclass] methods:
  118. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    Object Object: RClass super: BasicObject
  119. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    Object Object: RClass super: BasicObject foo_eigen: RClass
  120. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    Object Object: RClass super: BasicObject foo_eigen: RClass klass: Class
  121. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    Object Object: RClass super: BasicObject foo_eigen: RClass klass: Class flags: [:singleton]
  122. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    Object Object: RClass super: BasicObject foo_eigen: RClass klass: Class flags: [:singleton] super: Object
  123. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    Object Object: RClass super: BasicObject foo_eigen: RClass klass: Class flags: [:singleton] super: Object methods: {:bar}
  124. foo = Object.new def foo.bar “BAZ!” end foo: RObject klass:

    foo_eigen Object: RClass super: BasicObject foo_eigen: RClass klass: Class flags: [:singleton] super: Object methods: {:bar}
  125. class A def self.foo “BAR!” end end class B <

    A end Class: RClass klass: Class
  126. class A def self.foo “BAR!” end end class B <

    A end Class: RClass klass: Class super: Module
  127. class A def self.foo “BAR!” end end class B <

    A end A: RClass Class: RClass klass: Class super: Module
  128. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class Class: RClass klass: Class super: Module
  129. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class super: Object Class: RClass klass: Class super: Module
  130. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class super: Object Class: RClass klass: Class super: Module A_eigen: RClass
  131. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class super: Object Class: RClass klass: Class super: Module A_eigen: RClass klass: Class
  132. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class super: Object Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton]
  133. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class super: Object Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class
  134. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: Class super: Object Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo}
  135. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo}
  136. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo}
  137. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: Class Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo}
  138. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: Class super: A Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo}
  139. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: Class super: A Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo} B_eigen: RClass
  140. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: Class super: A Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo} B_eigen: RClass klass: Class
  141. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: Class super: A Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo} B_eigen: RClass klass: Class flags: [:singleton]
  142. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: Class super: A Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo} B_eigen: RClass klass: Class flags: [:singleton] super: A_eigen
  143. class A def self.foo “BAR!” end end class B <

    A end A: RClass klass: A_eigen super: Object B: RClass klass: B_eigen super: A Class: RClass klass: Class super: Module A_eigen: RClass klass: Class flags: [:singleton] super: Class methods: {:foo} B_eigen: RClass klass: Class flags: [:singleton] super: A_eigen
  144. The superclass of the eigenclass of a class is the

    eigenclass of the superclass of the class.
  145. The superclass of the eigenclass of a class is the

    eigenclass of the superclass of the class.
  146. The superclass of the eigenclass of a class is the

    eigenclass of the superclass of the class.
  147. The superclass of the eigenclass of a class is the

    eigenclass of the superclass of the class.
  148. The superclass of the eigenclass of a class is the

    eigenclass of the superclass of the class.
  149. The superclass of the eigenclass of a class is the

    eigenclass of the superclass of the class.
  150. class A class B class C end end end klass:

    A klass: Object next: nil A : RClass constants: {}
  151. class A class B class C end end end klass:

    A next: <main> klass: Object next: nil A : RClass constants: {}
  152. class A class B class C end end end klass:

    A next: <main> klass: Object next: nil A : RClass constants: {}
  153. class A class B class C end end end klass:

    B klass: A next: <main> klass: Object next: nil B : RClass constants: {} A : RClass constants: {}
  154. class A class B class C end end end klass:

    B next: class A klass: A next: <main> klass: Object next: nil B : RClass constants: {} A : RClass constants: {}
  155. class A class B class C end end end klass:

    B next: class A klass: A next: <main> klass: Object next: nil B : RClass constants: {} A : RClass constants: {:B}
  156. class A class B class C end end end klass:

    B next: class A klass: A next: <main> klass: Object next: nil B : RClass constants: {} A : RClass constants: {:B}
  157. class A class B class C end end end klass:

    C klass: B next: class A klass: A next: <main> klass: Object next: nil B : RClass constants: {} C : RClass constants: {} A : RClass constants: {:B}
  158. class A class B class C end end end klass:

    C next: class B klass: B next: class A klass: A next: <main> klass: Object next: nil B : RClass constants: {} C : RClass constants: {} A : RClass constants: {:B}
  159. class A class B class C end end end klass:

    C next: class B klass: B next: class A klass: A next: <main> klass: Object next: nil B : RClass constants: {:C} C : RClass constants: {} A : RClass constants: {:B}
  160. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end
  161. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end
  162. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: Object next: nil
  163. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: A klass: Object next: nil A : RClass
  164. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: A next: <main> klass: Object next: nil A : RClass
  165. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: A next: <main> klass: Object next: nil A : RClass constants: {:X}
  166. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: B klass: A next: <main> klass: Object next: nil B : RClass A : RClass constants: {:X}
  167. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass A : RClass constants: {:X}
  168. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X} A : RClass constants: {:X}
  169. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X} C : RClass A : RClass constants: {:X}
  170. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X} C : RClass A : RClass constants: {:X}
  171. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X} C : RClass A : RClass constants: {:X} super: A
  172. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C} C : RClass A : RClass constants: {:X} super: A
  173. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C} C : RClass A : RClass constants: {:X} klass: D D : RClass super: A
  174. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C} C : RClass A : RClass constants: {:X} klass: D D : RClass super: A super: A
  175. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C} C : RClass A : RClass constants: {:X} klass: D next: <main> D : RClass super: A super: A
  176. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C, :D} C : RClass A : RClass constants: {:X} klass: D next: <main> D : RClass super: A super: A
  177. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C, :D} C : RClass A : RClass constants: {:X} klass: D next: <main> D : RClass super: A super: A =2
  178. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C, :D} C : RClass A : RClass constants: {:X} klass: D next: <main> D : RClass super: A super: A
  179. class A X = 1 end class B X =

    2 class C < A puts X end end class B::D < A puts X end klass: C next: class B klass: B next: <main> klass: A next: <main> klass: Object next: nil B : RClass constants: {:X, :C, :D} C : RClass A : RClass constants: {:X} klass: D next: <main> D : RClass super: A super: A =1
  180. == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,40)> (catch: TRUE) == catch table |

    catch type: rescue st: 0000 ed: 0006 sp: 0000 cont: 0007 | == disasm: #<ISeq:rescue in <main>@-e:1 (1,20)-(1,36)> (catch: TRUE) | local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | [ 1] "\#$!"@0 | 0000 getlocal_WC_0 "\#$!"@0 ( 1) | 0002 putobject StandardError | 0004 checkmatch 3 | 0006 branchunless 15 | 0008 putself [Li] | 0009 getglobal $! | 0011 opt_send_without_block <callinfo!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, <callcache> | 0014 leave | 0015 getlocal_WC_0 "\#$!"@0 | 0017 throw 0 | catch type: retry st: 0006 ed: 0007 sp: 0000 cont: 0000 |------------------------------------------------------------------------ 0000 putself ( 1)[Li] 0001 putstring "foo" 0003 opt_send_without_block <callinfo!mid:raise, argc:1, FCALL|ARGS_SIMPLE>, <callcache> 0006 nop 0007 leave
  181. == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,40)> (catch: TRUE) == catch table |

    catch type: rescue st: 0000 ed: 0006 sp: 0000 cont: 0007 | == disasm: #<ISeq:rescue in <main>@-e:1 (1,20)-(1,36)> (catch: TRUE) | local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | [ 1] "\#$!"@0 | 0000 getlocal_WC_0 "\#$!"@0 ( 1) | 0002 putobject StandardError | 0004 checkmatch 3 | 0006 branchunless 15 | 0008 putself [Li] | 0009 getglobal $! | 0011 opt_send_without_block <callinfo!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, <callcache> | 0014 leave | 0015 getlocal_WC_0 "\#$!"@0 | 0017 throw 0 | catch type: retry st: 0006 ed: 0007 sp: 0000 cont: 0000 |------------------------------------------------------------------------ 0000 putself ( 1)[Li] 0001 putstring "foo" 0003 opt_send_without_block <callinfo!mid:raise, argc:1, FCALL|ARGS_SIMPLE>, <callcache> 0006 nop 0007 leave
  182. == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,40)> (catch: TRUE) == catch table |

    catch type: rescue st: 0000 ed: 0006 sp: 0000 cont: 0007 | == disasm: #<ISeq:rescue in <main>@-e:1 (1,20)-(1,36)> (catch: TRUE) | local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | [ 1] "\#$!"@0 | 0000 getlocal_WC_0 "\#$!"@0 ( 1) | 0002 putobject StandardError | 0004 checkmatch 3 | 0006 branchunless 15 | 0008 putself [Li] | 0009 getglobal $! | 0011 opt_send_without_block <callinfo!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, <callcache> | 0014 leave | 0015 getlocal_WC_0 "\#$!"@0 | 0017 throw 0 | catch type: retry st: 0006 ed: 0007 sp: 0000 cont: 0000 |------------------------------------------------------------------------ 0000 putself ( 1)[Li] 0001 putstring "foo" 0003 opt_send_without_block <callinfo!mid:raise, argc:1, FCALL|ARGS_SIMPLE>, <callcache> 0006 nop 0007 leave
  183. == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,40)> (catch: TRUE) == catch table |

    catch type: rescue st: 0000 ed: 0006 sp: 0000 cont: 0007 | == disasm: #<ISeq:rescue in <main>@-e:1 (1,20)-(1,36)> (catch: TRUE) | local table (size: 1, argc: 0 [opts: 0, rest: -1, post: 0, block: -1, kw: -1@-1, kwrest: -1]) | [ 1] "\#$!"@0 | 0000 getlocal_WC_0 "\#$!"@0 ( 1) | 0002 putobject StandardError | 0004 checkmatch 3 | 0006 branchunless 15 | 0008 putself [Li] | 0009 getglobal $! | 0011 opt_send_without_block <callinfo!mid:puts, argc:1, FCALL|ARGS_SIMPLE>, <callcache> | 0014 leave | 0015 getlocal_WC_0 "\#$!"@0 | 0017 throw 0 | catch type: retry st: 0006 ed: 0007 sp: 0000 cont: 0000 |------------------------------------------------------------------------ 0000 putself ( 1)[Li] 0001 putstring "foo" 0003 opt_send_without_block <callinfo!mid:raise, argc:1, FCALL|ARGS_SIMPLE>, <callcache> 0006 nop 0007 leave
  184. ☐ Tokenizing & Parsing ☐ Compiling ☐ Executing Implement the

    entire frickin’ Ruby standard library!!!!
  185. ☐ Tokenizing & Parsing ☐ Compiling ☐ Executing Implement the

    entire frickin’ Ruby standard library!!!!
  186. ☐ Tokenizing & Parsing ☐ Compiling ☐ Executing Implement the

    entire frickin’ Ruby standard library!!!! Implement enough of the Ruby standard library to be demo-able
  187. class BasicObject def nil? false end end class Object <

    BasicObject end class NilClass < Object end