namechange
This commit is contained in:
parent
da9a57b3cf
commit
7b6f364ba8
2
Gemfile
2
Gemfile
@ -1,7 +1,7 @@
|
|||||||
source "http://rubygems.org"
|
source "http://rubygems.org"
|
||||||
|
|
||||||
gem "parslet" , :git => 'https://github.com/NigelThorne/parslet.git'
|
gem "parslet" , :git => 'https://github.com/NigelThorne/parslet.git'
|
||||||
gem "kide-reader" , "0.1.0" , :require => "parser" , :git => "https://github.com/kide-vm/kide-reader.git"
|
gem "salama-reader" , "0.1.0" , :require => "parser" , :git => "https://github.com/salama-vm/salama-reader.git"
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
gem "minitest"
|
gem "minitest"
|
||||||
|
@ -6,10 +6,10 @@ GIT
|
|||||||
blankslate (~> 2.0)
|
blankslate (~> 2.0)
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/kide-vm/kide-reader.git
|
remote: https://github.com/salama-vm/salama-reader.git
|
||||||
revision: 03ad97ef279cfbf27720db20130303999cdf2326
|
revision: 03ad97ef279cfbf27720db20130303999cdf2326
|
||||||
specs:
|
specs:
|
||||||
kide-reader (0.1.0)
|
salama-reader (0.1.0)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
remote: http://rubygems.org/
|
remote: http://rubygems.org/
|
||||||
@ -88,7 +88,7 @@ PLATFORMS
|
|||||||
|
|
||||||
DEPENDENCIES
|
DEPENDENCIES
|
||||||
jeweler
|
jeweler
|
||||||
kide-reader (= 0.1.0)!
|
salama-reader (= 0.1.0)!
|
||||||
minitest
|
minitest
|
||||||
parslet!
|
parslet!
|
||||||
pry
|
pry
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#Kide
|
#Salama
|
||||||
|
|
||||||
|
|
||||||
Kide is about native code generation in and of ruby. In is done.
|
Salama is about native code generation in and of ruby. In is done.
|
||||||
|
|
||||||
### Step 1 - Assembly
|
### Step 1 - Assembly
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ Celebrate New year 2030
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Contributing to kide
|
Contributing to salama
|
||||||
-----------------------
|
-----------------------
|
||||||
|
|
||||||
Probably best to talk to me, if it's not a typo or so.
|
Probably best to talk to me, if it's not a typo or so.
|
||||||
|
6
Rakefile
6
Rakefile
@ -14,8 +14,8 @@ require 'rake'
|
|||||||
require 'jeweler'
|
require 'jeweler'
|
||||||
Jeweler::Tasks.new do |gem|
|
Jeweler::Tasks.new do |gem|
|
||||||
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
||||||
gem.name = "kide"
|
gem.name = "salama"
|
||||||
gem.homepage = "http://github.com/kide-ruby/kide"
|
gem.homepage = "http://github.com/salama-ruby/salama"
|
||||||
gem.license = "MIT"
|
gem.license = "MIT"
|
||||||
gem.summary = %Q{Create fast code}
|
gem.summary = %Q{Create fast code}
|
||||||
gem.description = %Q{A long way to china and back}
|
gem.description = %Q{A long way to china and back}
|
||||||
@ -51,7 +51,7 @@ Rake::RDocTask.new do |rdoc|
|
|||||||
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
||||||
|
|
||||||
rdoc.rdoc_dir = 'rdoc'
|
rdoc.rdoc_dir = 'rdoc'
|
||||||
rdoc.title = "kide #{version}"
|
rdoc.title = "salama #{version}"
|
||||||
rdoc.rdoc_files.include('README*')
|
rdoc.rdoc_files.include('README*')
|
||||||
rdoc.rdoc_files.include('lib/**/*.rb')
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
||||||
end
|
end
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
### Ast
|
### 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
|
### Compiling
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ module Ast
|
|||||||
context.current_class = clazz
|
context.current_class = clazz
|
||||||
expressions.each do |expression|
|
expressions.each do |expression|
|
||||||
# check if it's a function definition and add
|
# 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
|
raise "only functions for now #{expression.inspect}" unless expression.is_a? Ast::FunctionExpression
|
||||||
puts "compiling expression #{expression}"
|
puts "compiling expression #{expression}"
|
||||||
expression_value = expression.compile(context )
|
expression_value = expression.compile(context )
|
||||||
|
@ -55,7 +55,7 @@ module Boot
|
|||||||
end
|
end
|
||||||
[:putstring,:putint,:fibo,:exit].each do |f|
|
[:putstring,:putint,:fibo,:exit].each do |f|
|
||||||
#puts "Boot Kernel::#{f}"
|
#puts "Boot Kernel::#{f}"
|
||||||
obj.add_method_definition Kide::Kernel.send(f , @context)
|
obj.add_method_definition Salama::Kernel.send(f , @context)
|
||||||
end
|
end
|
||||||
obj = get_or_create_class :String
|
obj = get_or_create_class :String
|
||||||
[:get , :set].each do |f|
|
[: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,
|
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.
|
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.
|
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
|
#integer related kernel functions
|
||||||
module Kide
|
module Salama
|
||||||
module Kernel
|
module Kernel
|
||||||
# The conversion to base10 is quite a bit more complicated than i thought. The bulk of it is in div10
|
# 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
|
# We set up variables, do the devision and write the result to the string
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Kide
|
module Salama
|
||||||
module Kernel
|
module Kernel
|
||||||
def self.putstring context
|
def self.putstring context
|
||||||
function = Virtual::MethodDefinition.new(:putstring , [] )
|
function = Virtual::MethodDefinition.new(:putstring , [] )
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
module Kide
|
module Salama
|
||||||
module Kernel
|
module Kernel
|
||||||
def self.exit context
|
def self.exit context
|
||||||
function = Virtual::MethodDefinition.new(:exit , [] , Virtual::Integer)
|
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.
|
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:
|
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
|
# 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
|
# 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
|
# We have basic classes (literally) of instructions
|
||||||
# - Memory
|
# - Memory
|
||||||
|
@ -69,7 +69,7 @@ module Boot
|
|||||||
end
|
end
|
||||||
[:utoa, :putstring,:putint,:fibo,:exit].each do |f|
|
[:utoa, :putstring,:putint,:fibo,:exit].each do |f|
|
||||||
#puts "Boot Kernel::#{f}"
|
#puts "Boot Kernel::#{f}"
|
||||||
obj.add_function Kide::Kernel.send(f , @context)
|
obj.add_function Salama::Kernel.send(f , @context)
|
||||||
end
|
end
|
||||||
obj = get_or_create_class :String
|
obj = get_or_create_class :String
|
||||||
[:get , :set].each do |f|
|
[: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.
|
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
|
# this is not a "normal" ruby file, ie it is not required by salama
|
||||||
# instead it is parsed by kide to define part of the kide that runs
|
# instead it is parsed by salama to define part of the salama that runs
|
||||||
|
|
||||||
class Array < BaseObject
|
class Array < BaseObject
|
||||||
def initialize size
|
def initialize size
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
require 'parslet'
|
require 'parslet'
|
||||||
|
|
||||||
require "elf/object_writer"
|
require "elf/object_writer"
|
||||||
require 'kide-reader'
|
require 'salama-reader'
|
||||||
require 'parser/transform'
|
require 'parser/transform'
|
||||||
require "virtual/machine"
|
require "virtual/machine"
|
||||||
require "ast/all"
|
require "ast/all"
|
@ -1,17 +1,17 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
Gem::Specification.new do |s|
|
Gem::Specification.new do |s|
|
||||||
s.name = 'kide'
|
s.name = 'salama'
|
||||||
s.version = '0.0.1'
|
s.version = '0.0.1'
|
||||||
|
|
||||||
s.authors = ['Torsten Ruger']
|
s.authors = ['Torsten Ruger']
|
||||||
s.email = 'torsten@villataika.fi'
|
s.email = 'torsten@villataika.fi'
|
||||||
s.extra_rdoc_files = ['README.markdown']
|
s.extra_rdoc_files = ['README.markdown']
|
||||||
s.files = %w(README.markdown LICENSE.txt Rakefile) + Dir.glob("lib/**/*")
|
s.files = %w(README.markdown LICENSE.txt Rakefile) + Dir.glob("lib/**/*")
|
||||||
s.homepage = 'https://github.com/kide-vm/kide'
|
s.homepage = 'https://github.com/salama-vm/salama'
|
||||||
s.license = 'MIT'
|
s.license = 'MIT'
|
||||||
s.require_paths = ['lib']
|
s.require_paths = ['lib']
|
||||||
s.summary = 'Hey kide, what do you want to be when you grow up: I like pink and red, i wanna be a ruby'
|
s.summary = 'Hey salama, what do you want to be when you grow up: I like pink and red, i wanna be a ruby'
|
||||||
|
|
||||||
s.add_dependency 'parslet', '~> 1.6.1'
|
s.add_dependency 'parslet', '~> 1.6.1'
|
||||||
end
|
end
|
@ -17,7 +17,7 @@ module Fragments
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse
|
def parse
|
||||||
parser = Parser::Kide.new
|
parser = Parser::Salama.new
|
||||||
syntax = parser.parse_with_debug(@string_input)
|
syntax = parser.parse_with_debug(@string_input)
|
||||||
parts = Parser::Transform.new.apply(syntax)
|
parts = Parser::Transform.new.apply(syntax)
|
||||||
# file is a list of expressions, all but the last must be a function
|
# file is a list of expressions, all but the last must be a function
|
||||||
|
@ -5,10 +5,10 @@ class TestHello < MiniTest::Test
|
|||||||
|
|
||||||
def test_hello
|
def test_hello
|
||||||
@string_input = <<HERE
|
@string_input = <<HERE
|
||||||
"Hello Raisa, I am kide".putstring()
|
"Hello Raisa, I am salama".putstring()
|
||||||
HERE
|
HERE
|
||||||
@should = [0x0,0x40,0x2d,0xe9,0x1,0x0,0xa0,0xe3,0x2,0x10,0xa0,0xe1,0x3,0x20,0xa0,0xe1,0x4,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x80,0xbd,0xe8]
|
@should = [0x0,0x40,0x2d,0xe9,0x1,0x0,0xa0,0xe3,0x2,0x10,0xa0,0xe1,0x3,0x20,0xa0,0xe1,0x4,0x70,0xa0,0xe3,0x0,0x0,0x0,0xef,0x0,0x80,0xbd,0xe8]
|
||||||
@output = "Hello Raisa, I am kide "
|
@output = "Hello Raisa, I am salama "
|
||||||
@target = [:Object , :putstring]
|
@target = [:Object , :putstring]
|
||||||
parse
|
parse
|
||||||
write "hello"
|
write "hello"
|
||||||
|
@ -75,7 +75,7 @@ HERE
|
|||||||
end
|
end
|
||||||
|
|
||||||
def parse
|
def parse
|
||||||
parser = Parser::Kide.new
|
parser = Parser::Salama.new
|
||||||
syntax = parser.parse_with_debug(@string_input)
|
syntax = parser.parse_with_debug(@string_input)
|
||||||
parts = Parser::Transform.new.apply(syntax)
|
parts = Parser::Transform.new.apply(syntax)
|
||||||
# file is a list of expressions, all but the last must be a function
|
# file is a list of expressions, all but the last must be a function
|
||||||
|
@ -28,4 +28,4 @@ require "minitest/autorun"
|
|||||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
||||||
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
|
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'test'))
|
||||||
|
|
||||||
require 'kide'
|
require 'salama'
|
||||||
|
@ -19,7 +19,7 @@ class TestRunner < MiniTest::Test
|
|||||||
|
|
||||||
def execute file
|
def execute file
|
||||||
string = File.read(file)
|
string = File.read(file)
|
||||||
parser = Parser::Kide.new
|
parser = Parser::Salama.new
|
||||||
object_space = Vm::Program.new "Arm"
|
object_space = Vm::Program.new "Arm"
|
||||||
syntax = parser.parse_with_debug(string)
|
syntax = parser.parse_with_debug(string)
|
||||||
assert syntax
|
assert syntax
|
||||||
|
@ -8,7 +8,7 @@ module VirtualHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def check
|
def check
|
||||||
parser = Parser::Kide.new
|
parser = Parser::Salama.new
|
||||||
syntax = parser.parse_with_debug(@string_input)
|
syntax = parser.parse_with_debug(@string_input)
|
||||||
parts = Parser::Transform.new.apply(syntax)
|
parts = Parser::Transform.new.apply(syntax)
|
||||||
machine = Virtual::Machine.new
|
machine = Virtual::Machine.new
|
||||||
|
Loading…
Reference in New Issue
Block a user