introduce statement class for mom

This commit is contained in:
Torsten Ruger 2017-09-06 12:11:30 +03:00
parent 0e98179888
commit 0e51492430
3 changed files with 10 additions and 5 deletions

View File

@ -1,5 +1,5 @@
module Mom module Mom
class IfStatement < Instruction class IfStatement < Statement
attr_reader :condition , :if_true , :if_false attr_reader :condition , :if_true , :if_false
attr_accessor :hoisted attr_accessor :hoisted

View File

@ -4,10 +4,8 @@ module Mom
class Instruction class Instruction
attr :next_instruction attr :next_instruction
# flattening will change the structure from a tree to a linked list (and use # implement flatten as noop to avoid condition
# next_instruction to do so)
def flatten def flatten
raise "not implemented"
end end
end end
@ -19,6 +17,13 @@ module Mom
end end
end end
class Statement
# flattening will change the structure from a tree to a linked list (and use
# next_instruction to do so)
def flatten
raise "not implemented"
end
end
end end

View File

@ -1,6 +1,6 @@
module Mom module Mom
class WhileStatement < Instruction class WhileStatement < Statement
attr_reader :condition , :statements attr_reader :condition , :statements
attr_accessor :hoisted attr_accessor :hoisted