class AST::Unary attr_reader :operation, :expr def initialize(operation, expr) @operation = operation @expr = expr end def ==(other) other.operation == @operation && other.expr == @expr end def execute(env) case @operation when AST::Operators::SUBTRACT 0.0 - @expr.execute(env) when AST::Operators::NOT !@expr.execute(env) end end end