assembler will need redoing somewhat

with own data objects, we can assemble into them first
then write
may also store cpu instructions
This commit is contained in:
Torsten Ruger
2018-03-25 18:23:00 +03:00
parent 82ab8ac4d3
commit a50368c3aa
4 changed files with 21 additions and 8 deletions

View File

@ -38,7 +38,6 @@ module Parfait
def init(arguments, frame)
raise "Wrong argument type, expect Type not #{arguments.class}" unless arguments.is_a? Type
raise "Wrong frame type, expect Type not #{frame.class}" unless frame.is_a? Type
@binary = BinaryCode.new 0
@arguments = arguments
@frame = frame
end
@ -47,6 +46,11 @@ module Parfait
@instructions = inst
end
def create_binary
total = @instructions.total_byte_length / 4 + 1
@binary = BinaryCode.new( total )
end
# determine whether this method has an argument by the name
def has_argument( name )
raise "has_argument #{name}.#{name.class}" unless name.is_a? Symbol