reditribute boot dir evenly. some was parfait, some virtual, some kernel
This commit is contained in:
parent
5f3b0c1779
commit
dd82095cca
@ -1,15 +1,13 @@
|
||||
GIT
|
||||
remote: https://github.com/salama/salama-reader.git
|
||||
revision: 484990b093f0b01b61028902aa5fcafee7a7c9b6
|
||||
revision: 1272af6c660efe0af93d7f5ad87d98bd04ce5d22
|
||||
specs:
|
||||
salama-reader (0.0.2)
|
||||
salama (~> 0.0.1)
|
||||
|
||||
PATH
|
||||
remote: /Users/raisa/salama-arm
|
||||
specs:
|
||||
salama-arm (0.0.1)
|
||||
salama (~> 0.0.1)
|
||||
|
||||
GEM
|
||||
remote: http://rubygems.org/
|
||||
@ -75,8 +73,6 @@ GEM
|
||||
ruby_parser (~> 3.2, >= 3.2.2)
|
||||
ruby_parser (3.6.1)
|
||||
sexp_processor (~> 4.1)
|
||||
salama (0.0.1)
|
||||
parslet (~> 1.6.1)
|
||||
sexp_processor (4.4.3)
|
||||
simplecov (0.8.2)
|
||||
docile (~> 1.1.0)
|
||||
|
@ -8,7 +8,7 @@ module Ast
|
||||
end
|
||||
r = receiver ? receiver.compile(method,message) : Virtual::Self.new()
|
||||
new_method = Virtual::MethodDefinition.new(name , args , r )
|
||||
new_method.class_name = r.is_a?(Boot::BootClass) ? r.name : method.class_name
|
||||
new_method.class_name = r.is_a?(BootClass) ? r.name : method.class_name
|
||||
clazz = Virtual::Object.space.get_or_create_class(new_method.class_name)
|
||||
clazz.add_instance_method new_method
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
module Boot
|
||||
class String
|
||||
module ClassMethods
|
||||
def get context , index = Virtual::Integer
|
||||
get_function = Virtual::MethodDefinition.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
|
||||
return get_function
|
||||
end
|
||||
def set context , index = Virtual::Integer , char = Virtual::Integer
|
||||
set_function = Virtual::MethodDefinition.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
|
||||
return set_function
|
||||
end
|
||||
def puts context
|
||||
puts_function = Virtual::MethodDefinition.new(:puts , [] )
|
||||
return puts_function
|
||||
end
|
||||
end
|
||||
extend ClassMethods
|
||||
end
|
||||
end
|
@ -1,3 +1,4 @@
|
||||
require_relative "integer"
|
||||
require_relative "string"
|
||||
require_relative "system"
|
||||
require_relative "object"
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Boot
|
||||
module Salama
|
||||
class Object
|
||||
module ClassMethods
|
||||
|
@ -8,4 +8,21 @@ module Salama
|
||||
function
|
||||
end
|
||||
end
|
||||
class String
|
||||
module ClassMethods
|
||||
def get context , index = Virtual::Integer
|
||||
get_function = Virtual::MethodDefinition.new(:get , [ Virtual::Integer] , Virtual::Integer , Virtual::Integer )
|
||||
return get_function
|
||||
end
|
||||
def set context , index = Virtual::Integer , char = Virtual::Integer
|
||||
set_function = Virtual::MethodDefinition.new(:set , [Virtual::Integer, Virtual::Integer] , Virtual::Integer ,Virtual::Integer )
|
||||
return set_function
|
||||
end
|
||||
def puts context
|
||||
puts_function = Virtual::MethodDefinition.new(:puts , [] )
|
||||
return puts_function
|
||||
end
|
||||
end
|
||||
extend ClassMethods
|
||||
end
|
||||
end
|
||||
|
@ -1,6 +1,5 @@
|
||||
require_relative "meta_class"
|
||||
require "virtual/meta_class"
|
||||
|
||||
module Boot
|
||||
# class is mainly a list of methods with a name (for now)
|
||||
# layout of object is seperated into Layout
|
||||
class BootClass < Virtual::ObjectConstant
|
||||
@ -10,7 +9,7 @@ module Boot
|
||||
@instance_methods = []
|
||||
@name = name.to_sym
|
||||
@super_class_name = super_class_name.to_sym
|
||||
@meta_class = MetaClass.new(self)
|
||||
@meta_class = Virtual::MetaClass.new(self)
|
||||
end
|
||||
attr_reader :name , :instance_methods , :meta_class , :context , :super_class_name
|
||||
def add_instance_method method
|
||||
@ -42,4 +41,3 @@ module Boot
|
||||
end
|
||||
|
||||
end
|
||||
end
|
@ -1,10 +1,7 @@
|
||||
require_relative "boot_class"
|
||||
#require "vm/call_site"
|
||||
require "parfait/boot_class"
|
||||
require "kernel/all"
|
||||
require_relative "object"
|
||||
require_relative "string"
|
||||
|
||||
module Boot
|
||||
module Virtual
|
||||
# The BootSpace contains all objects for a program. In functional terms it is a program, but in oo
|
||||
# it is a collection of objects, some of which are data, some classes, some functions
|
||||
|
||||
@ -66,7 +63,7 @@ module Boot
|
||||
obj = get_or_create_class :Object
|
||||
[:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|
|
||||
#puts "Boot Object::#{f}"
|
||||
obj.add_instance_method Boot::Object.send(f , @context)
|
||||
obj.add_instance_method Salama::Object.send(f , @context)
|
||||
end
|
||||
[:putstring,:putint,:fibo,:exit].each do |f|
|
||||
#puts "Boot Kernel::#{f}"
|
||||
@ -75,7 +72,7 @@ module Boot
|
||||
obj = get_or_create_class :String
|
||||
[:get , :set , :puts].each do |f|
|
||||
#puts "Boot String::#{f}"
|
||||
obj.add_instance_method Boot::String.send(f , @context)
|
||||
obj.add_instance_method Salama::String.send(f , @context)
|
||||
end
|
||||
end
|
||||
|
@ -83,5 +83,5 @@ require_relative "value"
|
||||
require_relative "type"
|
||||
require_relative "object"
|
||||
require_relative "constants"
|
||||
require "boot/boot_space"
|
||||
require_relative "boot_space"
|
||||
require_relative "send_implementation"
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Boot
|
||||
module Virtual
|
||||
# class that acts like a class, but is really the object
|
||||
|
||||
# described in the ruby language book as the eigenclass, what you get with
|
@ -32,7 +32,7 @@ module Virtual
|
||||
if defined? @@space
|
||||
@@space
|
||||
else
|
||||
@@space = ::Boot::BootSpace.new
|
||||
@@space = BootSpace.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -9,8 +9,7 @@ module Virtual
|
||||
me = code.me
|
||||
next unless ( me.type == Reference)
|
||||
if( me.is_a? Constant)
|
||||
Boot::BootClass
|
||||
if( me.is_a? Boot::BootClass )
|
||||
if( me.is_a? BootClass )
|
||||
raise "unimplemented"
|
||||
elsif( me.is_a? ObjectConstant )
|
||||
clazz = me.clazz
|
||||
|
Loading…
Reference in New Issue
Block a user