Class: Alf::Algebra::Compiler

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/alf/algebra/support/compiler.rb

Instance Method Summary collapse

Methods included from Visitor

#copy_and_apply

Instance Method Details

#apply(expr, *args, &bl) ⇒ Object

copy all default implementation


14
15
16
# File 'lib/alf/algebra/support/compiler.rb', line 14

def apply(expr, *args, &bl)
  send to_method_name(expr, "on_"), expr, *args, &bl
end

#call(expr, *args, &bl) ⇒ Object

public interface


8
9
10
# File 'lib/alf/algebra/support/compiler.rb', line 8

def call(expr, *args, &bl)
  apply(expr, *args, &bl)
end

#not_supported(expr, *args, &bl) ⇒ Object

Raises:


22
23
24
# File 'lib/alf/algebra/support/compiler.rb', line 22

def not_supported(expr, *args, &bl)
  raise NotSupportedError, "Unexpected operand `#{expr}`"
end

#on_missing(expr, *args, &bl) ⇒ Object

Raises:


18
19
20
# File 'lib/alf/algebra/support/compiler.rb', line 18

def on_missing(expr, *args, &bl)
  raise NotSupportedError, "Unable to compile `#{expr}`"
end