revert to symbols

Parfait::Words were nice, but endless problems with the fact that when
you write “String” you get a string.
Symbols take care of uniqueness at the same time
This commit is contained in:
Torsten Ruger
2015-05-31 18:34:18 +03:00
parent 5d870ef154
commit bee73801eb
18 changed files with 101 additions and 85 deletions

View File

@ -9,7 +9,7 @@ module Builtin
# As we write before we recurse (save a push) we write the number backwards
# arguments: string address , integer
def utoa context
utoa_function = Virtual::CompiledMethodInfo.create_method("Integer" ,"utoa" , [ Virtual::Integer ] )
utoa_function = Virtual::CompiledMethodInfo.create_method(:Integer ,:utoa , [ Virtual::Integer ] )
function.info.return_type = Virtual::Integer
function.info.receiver = Virtual::Integer
return utoa_function
@ -29,7 +29,7 @@ module Builtin
end
def putint context
putint_function = Virtual::CompiledMethodInfo.create_method("Integer","putint" , [] )
putint_function = Virtual::CompiledMethodInfo.create_method(:Integer,:putint , [] )
putint_function.info.return_type = Virtual::Integer
putint_function.info.receiver = Virtual::Integer
return putint_function
@ -58,7 +58,7 @@ module Builtin
# a hand coded version of the fibonachi numbers
# not my hand off course, found in the net http://www.peter-cockerell.net/aalp/html/ch-5.html
def fibo context
fibo_function = Virtual::CompiledMethodInfo.create_method("Integer","fibo" , [] )
fibo_function = Virtual::CompiledMethodInfo.create_method(:Integer,:fibo , [] )
fibo_function.info.return_type = Virtual::Integer
fibo_function.info.receiver = Virtual::Integer
return fibo_function

View File

@ -5,7 +5,7 @@ module Builtin
# it isn't really a function, ie it is jumped to (not called), exits and may not return
# so it is responsible for initial setup (and relocation)
def __init__ context
function = Virtual::CompiledMethodInfo.create_method("Kernel","__init__" , [])
function = Virtual::CompiledMethodInfo.create_method(:Kernel,:__init__ , [])
# puts "INIT LAYOUT #{function.get_layout.get_layout}"
function.info.return_type = Virtual::Integer
main = Virtual::Machine.instance.space.get_main
@ -16,14 +16,14 @@ module Builtin
return function
end
def putstring context
function = Virtual::CompiledMethodInfo.create_method("Kernel" , "putstring" , [] )
function = Virtual::CompiledMethodInfo.create_method(:Kernel , :putstring , [] )
return function
ret = Virtual::RegisterMachine.instance.write_stdout(function)
function.set_return ret
function
end
def exit context
function = Virtual::CompiledMethodInfo.create_method("Kernel","exit" , [])
function = Virtual::CompiledMethodInfo.create_method(:Kernel,:exit , [])
function.info.return_type = Virtual::Integer
return function
ret = Virtual::RegisterMachine.instance.exit(function)
@ -31,7 +31,7 @@ module Builtin
function
end
def __send context
function = Virtual::CompiledMethodInfo.create_method("Kernel" ,"__send" , [] )
function = Virtual::CompiledMethodInfo.create_method(:Kernel ,:__send , [] )
function.info.return_type = Virtual::Integer
return function
end

View File

@ -5,7 +5,7 @@ module Builtin
# main entry point, ie __init__ calls this
# defined here as empty, to be redefined
def main context
function = Virtual::CompiledMethodInfo.create_method("Object","main" , [])
function = Virtual::CompiledMethodInfo.create_method(:Object,:main , [])
return function
end
@ -17,7 +17,7 @@ module Builtin
# The at_index is just "below" the api, something we need but don't want to expose,
# so we can't code the above in ruby
def _get_instance_variable context , name = Virtual::Integer
get_function = Virtual::CompiledMethodInfo.create_method("Object","_get_instance_variable" , [ Virtual::Reference ] )
get_function = Virtual::CompiledMethodInfo.create_method(:Object,:_get_instance_variable , [ Virtual::Reference ] )
return get_function
me = get_function.receiver
var_name = get_function.args.first
@ -38,7 +38,7 @@ module Builtin
end
def _set_instance_variable(context , name = Virtual::Integer , value = Virtual::Integer )
set_function = Virtual::CompiledMethodInfo.create_method("Object","_set_instance_variable" ,[Virtual::Reference ,Virtual::Reference] )
set_function = Virtual::CompiledMethodInfo.create_method(:Object,:_set_instance_variable ,[Virtual::Reference ,Virtual::Reference] )
return set_function
receiver set_function
me = set_function.receiver