From 7d2dad89d2af01e1ca457659b0261859633fbcd8 Mon Sep 17 00:00:00 2001 From: Joel Martin Date: Thu, 10 Apr 2014 22:52:26 -0500 Subject: Ruby: add step5_tco Function type in types extends Proc. --- ruby/types.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'ruby/types.rb') diff --git a/ruby/types.rb b/ruby/types.rb index 02ca7a6..16d8d1e 100644 --- a/ruby/types.rb +++ b/ruby/types.rb @@ -1,6 +1,24 @@ +require "env" + class List < Array end class Vector < Array end +class Function < Proc + attr_accessor :ast + attr_accessor :env + attr_accessor :params + + def initialize(ast=nil, env=nil, params=nil, &block) + super() + @ast = ast + @env = env + @params = params + end + + def gen_env(args) + return Env.new(@env, @params, args) + end +end -- cgit v1.2.3