compile from mom compiler to risc

This commit is contained in:
2019-08-10 12:42:47 +03:00
parent 5994cd3276
commit d5f89a4979
8 changed files with 51 additions and 45 deletions

View File

@ -11,14 +11,14 @@ module Risc
#
class CallableCompiler
# Must pass the callable (method/block) and the constants that were parsed
# Must pass the callable (method/block)
# Also start instuction, usually a label is mandatory
def initialize( callable , constants , start)
def initialize( callable , mom_label)
@callable = callable
@regs = []
@constants = constants
@constants = []
@block_compilers = []
@current = @risc_instructions = start
@current = @risc_instructions = mom_label.risc_label(self)
reset_regs
end
attr_reader :risc_instructions , :constants , :block_compilers , :callable , :current

View File

@ -5,8 +5,10 @@ module Risc
class MethodCompiler < CallableCompiler
def initialize( method )
super(method)
# Methods starts with a Label, both in risc and mom.
# Pass in the callable(method) and the mom label that the method starts with
def initialize( method , mom_label)
super(method , mom_label)
end
#include block_compilers constants