add bools and nil

This commit is contained in:
Torsten Ruger
2014-06-30 17:51:07 +03:00
parent 040b842333
commit bc8697c733
10 changed files with 85 additions and 4 deletions

View File

@ -18,6 +18,22 @@ module Ast
end
end
class TrueExpression < Expression
def to_s
"true"
end
end
class FalseExpression < Expression
def to_s
"false"
end
end
class NilExpression < Expression
def to_s
"nil"
end
end
class NameExpression < Expression
attr_reader :name
def initialize name

View File

@ -10,7 +10,10 @@
module Ast
class Expression
def attributes
raise "abstract #{self}"
[]
end
def inspect
self.class.name + ".new()"
end
def == other
return false unless other.class == self.class