renamed method definition to compiled method
This commit is contained in:
@ -18,7 +18,7 @@ module Virtual
|
||||
def initialize machine = nil
|
||||
super()
|
||||
@classes = {}
|
||||
@main = Virtual::MethodDefinition.new("main" , [] )
|
||||
@main = Virtual::CompiledMethod.new("main" , [] )
|
||||
#global objects (data)
|
||||
@objects = []
|
||||
boot_classes! # boot is a verb here
|
||||
@ -63,7 +63,7 @@ module Virtual
|
||||
end
|
||||
# boot the classes, ie create a minimal set of classes with a minimal set of functions
|
||||
# minimal means only that which can not be coded in ruby
|
||||
# MethodDefinitions are grabbed from respective modules by sending the method name. This should return the
|
||||
# CompiledMethods are grabbed from respective modules by sending the method name. This should return the
|
||||
# implementation of the method (ie a method object), not actually try to implement it (as that's impossible in ruby)
|
||||
def boot_classes!
|
||||
# very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some
|
||||
|
@ -29,10 +29,10 @@ module Virtual
|
||||
# These (eg if/while) blocks may themselves have linear blocks ,but the last of these
|
||||
# MUST have an uncoditional branch. And remember, all roads lead to return.
|
||||
|
||||
class MethodDefinition < Virtual::Object
|
||||
class CompiledMethod < Virtual::Object
|
||||
#return the main function (the top level) into which code is compiled
|
||||
def MethodDefinition.main
|
||||
MethodDefinition.new(:main , [] )
|
||||
def CompiledMethod.main
|
||||
CompiledMethod.new(:main , [] )
|
||||
end
|
||||
def initialize name , args , receiver = Virtual::Self.new , return_type = Virtual::Mystery
|
||||
@name = name.to_sym
|
@ -57,7 +57,7 @@ module Virtual
|
||||
def compile_main bytes
|
||||
syntax = @parser.parse_with_debug(bytes)
|
||||
parts = Parser::Transform.new.apply(syntax)
|
||||
main = Virtual::MethodDefinition.main
|
||||
main = Virtual::CompiledMethod.main
|
||||
expressions = parts.compile( main , self.message )
|
||||
end
|
||||
|
||||
@ -76,7 +76,7 @@ end
|
||||
|
||||
#require_relative "list"
|
||||
require_relative "instruction"
|
||||
require_relative "method_definition"
|
||||
require_relative "compiled_method"
|
||||
require_relative "frame"
|
||||
require_relative "message"
|
||||
require_relative "value"
|
||||
|
Reference in New Issue
Block a user