start on class compiler

idea is to get cleaner layer seperation
reduce machine and rework builtin boot
This commit is contained in:
Torsten Ruger
2018-06-30 19:20:17 +03:00
parent 4a7cc72732
commit daf1b56062
11 changed files with 51 additions and 12 deletions

View File

@ -24,12 +24,12 @@ module Vool
def to_mom( _ )
create_class_object
mom = []
methods = []
body.statements.each do |node|
raise "Only methods for now #{node}" unless node.is_a?(MethodStatement)
mom << node.to_mom(@clazz)
methods << node.to_mom(@clazz)
end
mom
Mom::ClassCompiler.new(@clazz , methods)
end
def each(&block)

View File

@ -31,8 +31,9 @@ module Vool
# create mom instructions
def to_mom( method )
raise "Empty list ? #{statements.length}" if empty?
flat = @statements.shift.to_mom(method)
while( nekst = @statements.shift )
stats = @statements.dup
flat = stats.shift.to_mom(method)
while( nekst = stats.shift )
flat.append nekst.to_mom(method)
end
flat