From 99ced4369afbe4f7d5b9cb8e62c7e44d475345b1 Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Mon, 19 Mar 2018 21:18:56 +0530 Subject: [PATCH] adding Tue False and Nil Class to Parfait and boot --- lib/arm/arm_machine.rb | 2 +- lib/mom/instruction/basic_values.rb | 6 +++--- lib/parfait/integer.rb | 10 +++++++++- lib/risc/boot.rb | 7 ++++++- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/arm/arm_machine.rb b/lib/arm/arm_machine.rb index 9c7bfed0..bab40ca6 100644 --- a/lib/arm/arm_machine.rb +++ b/lib/arm/arm_machine.rb @@ -15,7 +15,7 @@ module Arm class ArmMachine # conditions specify all the possibilities for branches. Branches are b + condition - # Example: beq means brach if equal. + # Example: beq means branch if equal. # :al means always, so bal is an unconditional branch (but b() also works) CONDITIONS = [:al ,:eq ,:ne ,:lt ,:le ,:ge,:gt ,:cs ,:mi ,:hi ,:cc ,:pl,:ls ,:vc ,:vs] diff --git a/lib/mom/instruction/basic_values.rb b/lib/mom/instruction/basic_values.rb index 3b143896..69316c33 100644 --- a/lib/mom/instruction/basic_values.rb +++ b/lib/mom/instruction/basic_values.rb @@ -25,17 +25,17 @@ module Mom end class TrueConstant < Constant def ct_type - Parfait.object_space.get_class_by_name(:True).instance_type + Parfait.object_space.get_class_by_name(:TrueClass).instance_type end end class FalseConstant < Constant def ct_type - Parfait.object_space.get_class_by_name(:False).instance_type + Parfait.object_space.get_class_by_name(:FalseClass).instance_type end end class NilConstant < Constant def ct_type - Parfait.object_space.get_class_by_name(:Nil).instance_type + Parfait.object_space.get_class_by_name(:NilClass).instance_type end end class StringConstant < Constant diff --git a/lib/parfait/integer.rb b/lib/parfait/integer.rb index 868125df..d32aa43f 100644 --- a/lib/parfait/integer.rb +++ b/lib/parfait/integer.rb @@ -1,6 +1,6 @@ # Integer class for representing maths on Integers -# Integers are Objects, spcifically DataObjects +# Integers are Objects, specifically DataObjects # - they have fixed value # - they are immutable # (both by implementation, not design. @@ -21,4 +21,12 @@ module Parfait # :quo, :to_c, :real, :imaginary, :imag, :abs2, :arg, :angle, :phase, :rectangular, :rect, :polar, :conjugate, :conj, # :>, :>=, :<, :<=, :between? end + + # adding other base classes in here for now: + class FalseClass + end + class TrusClass + end + class NilClass + end end diff --git a/lib/risc/boot.rb b/lib/risc/boot.rb index 138efd0a..3d7e9d88 100644 --- a/lib/risc/boot.rb +++ b/lib/risc/boot.rb @@ -129,10 +129,15 @@ module Risc :return_address => :Integer, :return_value => :Integer, :caller => :Message , :name => :Word , :arguments => :NamedList }, :Integer => {}, + :TrueClass => {}, + :FalseClass => {}, + :NilClass => {}, :Object => {}, :Kernel => {}, #fix, kernel is a class, but should be a module :BinaryCode => {:char_length => :Integer} , - :Space => {:classes => :Dictionary , :types => :Dictionary , :first_message => :Message}, + :Space => {:classes => :Dictionary , :types => :Dictionary , + :first_message => :Message , single_true: :TrueClass, + single_false: :FalseClass , single_nil: :NilClass}, :NamedList => {}, :Type => {:names => :List , :types => :List , :object_class => :Class, :methods => :List } ,