start with block_compiler
as a copy of method_compiler re-merge later, when we know what's needed
This commit is contained in:
21
lib/risc/block_compiler.rb
Normal file
21
lib/risc/block_compiler.rb
Normal file
@ -0,0 +1,21 @@
|
||||
module Risc
|
||||
|
||||
# A BlockCompiler is much like a Mehtodcompiler, exept for blocks
|
||||
#
|
||||
class BlockCompiler
|
||||
|
||||
attr_reader :block , :risc_instructions , :constants
|
||||
|
||||
def initialize( block , method)
|
||||
@method = method
|
||||
@regs = []
|
||||
@block = block
|
||||
name = "#{method.self_type.name}.init"
|
||||
@risc_instructions = Risc.label(name, name)
|
||||
@risc_instructions << Risc.label( name, "unreachable")
|
||||
@current = @risc_instructions
|
||||
@constants = []
|
||||
end
|
||||
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user