adding Tue False and Nil Class to Parfait

and boot
This commit is contained in:
Torsten Ruger 2018-03-19 21:18:56 +05:30
parent d195ef68da
commit 99ced4369a
4 changed files with 19 additions and 6 deletions

View File

@ -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]

View File

@ -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

View File

@ -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

View File

@ -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 } ,