rubyx/lib/risc.rb
Torsten Rüger e61c5d4a55 Simplify Parfait booting
Since some weeks, Parfait uses instance variables instead of generated attribute getters (that needed type)
This makes it possible to simplify the boot process, getting rid of separate boot Space and class versions.
It is still quite order dependent, but all "normal" ruby code, (less magic) so easier to understand.

Also moved all code that can never run at runtime into the adapter. This included Space and Object new, space as the space will only ever be created at compile time and object, since that is quite different at run-time (which is where i am working towards)
2019-09-22 19:10:47 +03:00

46 lines
986 B
Ruby

class String
def camelise
self.split("_").collect{|str| str.capitalize_first }.join
end
def capitalize_first
self[0].capitalize + self[1..-1]
end
end
class Class
def short_name
self.name.split("::").last
end
end
# See risc/Readme
module Risc
# module method to reset, and init
def self.boot!(options = {})
Position.clear_positions
end
end
require_relative "risc/position/position"
require_relative "risc/platform"
require "parfait"
require_relative "risc/parfait_boot"
require_relative "risc/parfait_adapter"
require_relative "risc/linker"
require_relative "risc/callable_compiler"
require_relative "risc/method_compiler"
require_relative "risc/block_compiler"
require_relative "risc/assembler"
require_relative "risc/risc_collection"
class Integer
def fits_u8?
self >= 0 and self <= 255
end
end
require_relative "risc/instruction"
require_relative "risc/register_value"
require_relative "risc/text_writer"
require_relative "risc/builder"