had to let go of crystal (sniff) as the name was taken

This commit is contained in:
Torsten Ruger
2014-07-17 01:00:15 +03:00
parent f8e3f17660
commit fb105cb895
24 changed files with 34 additions and 34 deletions

View File

@ -7,7 +7,7 @@ module Ast
context.current_class = clazz
expressions.each do |expression|
# check if it's a function definition and add
# if not, execute it, but that does means we should be in crystal (executable), not ruby. ie throw an error for now
# if not, execute it, but that does means we should be in sapphire (executable), not ruby. ie throw an error for now
raise "only functions for now #{expression.inspect}" unless expression.is_a? Ast::FunctionExpression
puts "compiling expression #{expression}"
expression_value = expression.compile(context )

View File

@ -55,7 +55,7 @@ module Boot
end
[:putstring,:putint,:fibo,:exit].each do |f|
#puts "Boot Kernel::#{f}"
obj.add_method_definition Crystal::Kernel.send(f , @context)
obj.add_method_definition Sapphire::Kernel.send(f , @context)
end
obj = get_or_create_class :String
[:get , :set].each do |f|

View File

@ -8,7 +8,7 @@ function.
A normal ruby function is one that is parsed and transformed to code. But not all functionality can be written in ruby,
one of those chicken and egg things. C uses Assembler in this situation, we use Kernel function.
Slightly more here : http://crystal-vm.github.io/2014/06/10/more-clarity.html
Slightly more here : http://sapphire-vm.github.io/2014/06/10/more-clarity.html
The Kernal module is scattered into several files, but that is just so the file doesn't get too long.

View File

@ -1,5 +1,5 @@
#integer related kernel functions
module Crystal
module Sapphire
module Kernel
# The conversion to base10 is quite a bit more complicated than i thought. The bulk of it is in div10
# We set up variables, do the devision and write the result to the string

View File

@ -1,4 +1,4 @@
module Crystal
module Sapphire
module Kernel
def self.putstring context
function = Virtual::MethodDefinition.new(:putstring , [] )

View File

@ -1,4 +1,4 @@
module Crystal
module Sapphire
module Kernel
def self.exit context
function = Virtual::MethodDefinition.new(:exit , [] , Virtual::Integer)

View File

@ -8,7 +8,7 @@ provides the stack glue. All the stuff a compiler would usually do.
Also all syscalls are abstracted as functions.
The Crystal Convention
The Sapphire Convention
----------------------
Since we're not in c, we use the regsters more suitably for our job:

View File

@ -7,7 +7,7 @@ module Vm
# Admittately it would be simpler just to create the (abstract) instructions and let the machine
# encode them into what-ever is neccessary, but this approach leaves more possibility to
# optimize the actual instruction stream (not just the crystal instruction stream). Makes sense?
# optimize the actual instruction stream (not just the sapphire instruction stream). Makes sense?
# We have basic classes (literally) of instructions
# - Memory

View File

@ -7,7 +7,7 @@ module Ast
context.current_class = clazz
expressions.each do |expression|
# check if it's a function definition and add
# if not, execute it, but that does means we should be in crystal (executable), not ruby. ie throw an error for now
# if not, execute it, but that does means we should be in sapphire (executable), not ruby. ie throw an error for now
raise "only functions for now #{expression.inspect}" unless expression.is_a? Ast::FunctionExpression
puts "compiling expression #{expression}"
expression_value = expression.compile(context )

View File

@ -69,7 +69,7 @@ module Boot
end
[:utoa, :putstring,:putint,:fibo,:exit].each do |f|
#puts "Boot Kernel::#{f}"
obj.add_function Crystal::Kernel.send(f , @context)
obj.add_function Sapphire::Kernel.send(f , @context)
end
obj = get_or_create_class :String
[:get , :set].each do |f|

View File

@ -4,4 +4,4 @@ Here we have a placeholder for things i am currently developing.
Basically Parfait is the smallest amount of code needed to make a ruby-like OO system work.
A work in progress that started from here : http://crystal-vm.github.io/2014/06/10/more-clarity.html
A work in progress that started from here : http://sapphire-vm.github.io/2014/06/10/more-clarity.html

View File

@ -1,5 +1,5 @@
# this is not a "normal" ruby file, ie it is not required by crystal
# instead it is parsed by crystal to define part of the crystal that runs
# this is not a "normal" ruby file, ie it is not required by sapphire
# instead it is parsed by sapphire to define part of the sapphire that runs
class Array < BaseObject
def initialize size

View File

@ -1,7 +1,7 @@
require 'parslet'
require "elf/object_writer"
require 'parser/crystal'
require 'parser/sapphire'
require 'parser/transform'
require "virtual/machine"
require "ast/all"