Module: Trxl::Application2

Defined in:
lib/trxl/trxl_grammar.rb

Instance Method Summary collapse

Instance Method Details

#applicationsObject



1468
1469
1470
# File 'lib/trxl/trxl_grammar.rb', line 1468

def applications
  [ first_application ] + more_applications.elements.map { |e| e.actual_parameter_list }
end

#eval(env = Environment.new) ⇒ Object



1453
1454
1455
# File 'lib/trxl/trxl_grammar.rb', line 1453

def eval(env = Environment.new)
  left_associative_apply(operator, env)
end

#left_associative_apply(operator, env) ⇒ Object



1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
# File 'lib/trxl/trxl_grammar.rb', line 1457

def left_associative_apply(operator, env)
  applications.each do |actual_parameter_list|
    actuals = actual_parameter_list.eval(env)
    unless operator.instance_of?(Trxl::Function::Closure)
      operator = operator.eval(env)
    end
    operator = operator.apply(actuals)
  end
  operator
end

#to_s(env = Environment.new) ⇒ Object



1472
1473
1474
# File 'lib/trxl/trxl_grammar.rb', line 1472

def to_s(env = Environment.new)
  text_value
end