renamed program to assembler (to avoid clashes in vm)
This commit is contained in:
parent
990b4726ba
commit
fae0c1ab8c
@ -6,14 +6,14 @@ require "asm/string_literal"
|
||||
|
||||
module Asm
|
||||
|
||||
# Program is the the top-level of the code hierachy, except it is not derived from code
|
||||
# instead a Program is a list of blocks (and string constants)
|
||||
# Assembler is the the top-level of the code hierachy, except it is not derived from code
|
||||
# instead a Assembler is a list of blocks (and string constants)
|
||||
|
||||
# All code is created in blocks (see there) and there are two styles for that, for forward of backward
|
||||
# referencing. Read function block and add_block and Block.set
|
||||
|
||||
|
||||
class Program
|
||||
class Assembler
|
||||
|
||||
def initialize
|
||||
@blocks = []
|
@ -119,7 +119,7 @@ module Asm
|
||||
end
|
||||
|
||||
# length of the codes. In arm it would be the length * 4
|
||||
# (strings are stored globally in the Program)
|
||||
# (strings are stored globally in the Assembler)
|
||||
def length
|
||||
@codes.inject(0) {| sum , item | sum + item.length}
|
||||
end
|
||||
|
@ -1,6 +1,6 @@
|
||||
require 'parslet'
|
||||
|
||||
require "asm/program"
|
||||
require "asm/assembler"
|
||||
require "elf/object_writer"
|
||||
require 'parser/composed'
|
||||
require 'parser/transform'
|
||||
|
@ -6,9 +6,9 @@ require_relative 'helper'
|
||||
# adc add and bic eor orr rsb rsc sbc sub mov mvn cmn cmp teq tst b bl bx swi strb
|
||||
|
||||
class TestArmAsm < MiniTest::Test
|
||||
# need Program and a block (see those classes)
|
||||
# need Assembler and a block (see those classes)
|
||||
def setup
|
||||
@program = Asm::Program.new
|
||||
@program = Asm::Assembler.new
|
||||
#no ruby block given, ie need to add this block later by hand
|
||||
@block = @program.block
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ class TestRunner < MiniTest::Test
|
||||
# execute
|
||||
# check result ?
|
||||
context = Vm::Context.new
|
||||
builder = Asm::Program.new
|
||||
builder = Asm::Assembler.new
|
||||
compiled = tree.compile( builder , context )
|
||||
puts compiled.inspect
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ require_relative 'helper'
|
||||
class TestSmallProg < MiniTest::Test
|
||||
# need a code generator, for arm
|
||||
def setup
|
||||
@program = Asm::Program.new
|
||||
@program = Asm::Assembler.new
|
||||
end
|
||||
|
||||
def test_loop
|
||||
|
Loading…
Reference in New Issue
Block a user