2018-07-19 13:46:51 +02:00
|
|
|
module Ruby
|
|
|
|
|
|
|
|
# Base class for all statements in the tree. Derived classes correspond to known language
|
|
|
|
# constructs
|
|
|
|
#
|
|
|
|
# Compilers or compiler passes are written by implementing methods.
|
|
|
|
#
|
|
|
|
class Statement
|
|
|
|
|
|
|
|
def at_depth(depth , *strings)
|
|
|
|
prefix = " " * 2 * depth
|
|
|
|
strings.collect{|str| prefix + str}.join("\n")
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
class Expression
|
|
|
|
|
2018-07-19 13:59:10 +02:00
|
|
|
def to_vool
|
2018-07-19 13:46:51 +02:00
|
|
|
raise "should not be normalized #{self}"
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|