namechange
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
### Ast
|
||||
|
||||
The Ast (abstract syntax tree) is created by kide-reader gem and the classes defined there
|
||||
The Ast (abstract syntax tree) is created by salama-reader gem and the classes defined there
|
||||
|
||||
### Compiling
|
||||
|
||||
|
@ -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 kide (executable), not ruby. ie throw an error for now
|
||||
# if not, execute it, but that does means we should be in salama (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 )
|
||||
|
@ -55,7 +55,7 @@ module Boot
|
||||
end
|
||||
[:putstring,:putint,:fibo,:exit].each do |f|
|
||||
#puts "Boot Kernel::#{f}"
|
||||
obj.add_method_definition Kide::Kernel.send(f , @context)
|
||||
obj.add_method_definition Salama::Kernel.send(f , @context)
|
||||
end
|
||||
obj = get_or_create_class :String
|
||||
[:get , :set].each do |f|
|
||||
|
@ -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://kide-vm.github.io/2014/06/10/more-clarity.html
|
||||
Slightly more here : http://salama-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.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#integer related kernel functions
|
||||
module Kide
|
||||
module Salama
|
||||
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
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Kide
|
||||
module Salama
|
||||
module Kernel
|
||||
def self.putstring context
|
||||
function = Virtual::MethodDefinition.new(:putstring , [] )
|
||||
|
@ -1,4 +1,4 @@
|
||||
module Kide
|
||||
module Salama
|
||||
module Kernel
|
||||
def self.exit context
|
||||
function = Virtual::MethodDefinition.new(:exit , [] , Virtual::Integer)
|
||||
|
@ -8,7 +8,7 @@ provides the stack glue. All the stuff a compiler would usually do.
|
||||
|
||||
Also all syscalls are abstracted as functions.
|
||||
|
||||
The Kide Convention
|
||||
The Salama Convention
|
||||
----------------------
|
||||
|
||||
Since we're not in c, we use the regsters more suitably for our job:
|
||||
|
@ -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 kide instruction stream). Makes sense?
|
||||
# optimize the actual instruction stream (not just the salama instruction stream). Makes sense?
|
||||
|
||||
# We have basic classes (literally) of instructions
|
||||
# - Memory
|
||||
|
@ -69,7 +69,7 @@ module Boot
|
||||
end
|
||||
[:utoa, :putstring,:putint,:fibo,:exit].each do |f|
|
||||
#puts "Boot Kernel::#{f}"
|
||||
obj.add_function Kide::Kernel.send(f , @context)
|
||||
obj.add_function Salama::Kernel.send(f , @context)
|
||||
end
|
||||
obj = get_or_create_class :String
|
||||
[:get , :set].each do |f|
|
||||
|
@ -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://kide-vm.github.io/2014/06/10/more-clarity.html
|
||||
A work in progress that started from here : http://salama-vm.github.io/2014/06/10/more-clarity.html
|
||||
|
@ -1,5 +1,5 @@
|
||||
# this is not a "normal" ruby file, ie it is not required by kide
|
||||
# instead it is parsed by kide to define part of the kide that runs
|
||||
# this is not a "normal" ruby file, ie it is not required by salama
|
||||
# instead it is parsed by salama to define part of the salama that runs
|
||||
|
||||
class Array < BaseObject
|
||||
def initialize size
|
||||
|
@ -1,7 +1,7 @@
|
||||
require 'parslet'
|
||||
|
||||
require "elf/object_writer"
|
||||
require 'kide-reader'
|
||||
require 'salama-reader'
|
||||
require 'parser/transform'
|
||||
require "virtual/machine"
|
||||
require "ast/all"
|
Reference in New Issue
Block a user