class Bpl::AST::BinaryExpression

Public Instance Methods

eql?(be) click to toggle source
# File lib/bpl/ast/expression.rb, line 104
def eql?(be)
  be.is_a?(BinaryExpression) &&
  be.lhs.eql?(@lhs) && be.op == @op && be.rhs.eql?(@rhs)
end
show() click to toggle source
# File lib/bpl/ast/expression.rb, line 108
def show; "(#{yield @lhs} #{@op} #{yield @rhs})" end
type() click to toggle source
# File lib/bpl/ast/expression.rb, line 109
def type
  case @op
  when '<==>', '==>', '||', '&&', '==', '!=', '<', '>', '<=', '>=', '<:'
    Type::Boolean
  when '++'
    l = @lhs.type && l.is_a?(BitvectorType) &&
    r = @rhs.type && r.is_a?(BitvectorType) &&
    BitvectorType.new(width: l.width + r.width)
  when '+', '-', '*', '/', '%'
    Type::Integer
  end
end