removing builtin as a concept (wip)
the "old" way of generating compilers is now obsolete we can use ruby code with mom macros to achieve the same Three step wip remove old builtin fix tests (including adding necessary methods) fixup and inclusion of builtin code to parfait
This commit is contained in:
@ -14,16 +14,15 @@ module Mom
|
||||
@method_compilers = compilers
|
||||
end
|
||||
|
||||
# lazily instantiate the compilers for boot functions
|
||||
# (in the hope of only booting the functions once)
|
||||
def boot_compilers
|
||||
@boot_compilers ||= Mom::Builtin.boot_functions
|
||||
# lazily instantiate the compiler for init function
|
||||
def init_compiler
|
||||
@init_compilers ||= create_init_compiler
|
||||
end
|
||||
|
||||
# Return all compilers, namely the MethodCompilers passed in, plus the
|
||||
# boot_function's compilers (boot_compilers)
|
||||
def compilers
|
||||
@method_compilers + boot_compilers
|
||||
@method_compilers << init_compiler
|
||||
end
|
||||
|
||||
# Append another MomCompilers method_compilers to this one.
|
||||
@ -42,5 +41,23 @@ module Mom
|
||||
Risc::RiscCollection.new(riscs)
|
||||
end
|
||||
|
||||
# this is the really really first place the machine starts (apart from the jump here)
|
||||
# it isn't really a function, ie it is jumped to (not called), exits and may not return
|
||||
# so it is responsible for initial setup:
|
||||
# - load fist message, set up Space as receiver
|
||||
# - call main, ie set up message for that etc
|
||||
# - exit (exit_sequence) which passes a machine int out to c
|
||||
def create_init_compiler
|
||||
compiler = self.class.compiler_for(:Object,:__init__ ,{})
|
||||
compiler._reset_for_init # no return, just for init
|
||||
compiler.add_code Init.new("missing")
|
||||
return compiler
|
||||
end
|
||||
def self.compiler_for( clazz_name , method_name , arguments , locals = {})
|
||||
frame = Parfait::NamedList.type_for( locals )
|
||||
args = Parfait::NamedList.type_for( arguments )
|
||||
MethodCompiler.compiler_for_class(clazz_name , method_name , args, frame )
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user