class AST::VariableDeclaration attr_reader :name, :value def initialize(name, value) @name = name @value = value end def ==(other) other.is_a?(AST::VariableDeclaration) && other.name == @name && other.value == @value end def execute(env) if env.data[@name.name].nil? env.set(@name.name, @value) else raise "Invalid declaration of previously declared variable #{@name.name}" end end end