starting to rename to rubyx
This commit is contained in:
parent
0397d4064d
commit
1647b746ea
17
CodeStyle.md
17
CodeStyle.md
@ -1,7 +1,7 @@
|
|||||||
# Code Style and Conventions
|
# Code Style and Conventions
|
||||||
|
|
||||||
Just few things that have become important enough to write down. Apart from what is written here
|
Just few things that have become important enough to write down. Apart from what is written here
|
||||||
standard blah applies (ie RoboCop stuff).
|
standard blah applies (ie RoboCop/Reek stuff).
|
||||||
|
|
||||||
## Formatting
|
## Formatting
|
||||||
|
|
||||||
@ -9,6 +9,12 @@ standard blah applies (ie RoboCop stuff).
|
|||||||
|
|
||||||
While the days of 80 are over, too big steps seems difficult. I've settled on 100 (ish)
|
While the days of 80 are over, too big steps seems difficult. I've settled on 100 (ish)
|
||||||
|
|
||||||
|
### Brackets
|
||||||
|
|
||||||
|
While ruby allows the ommision of brackets even with arguments, i try to avoid that because
|
||||||
|
of readablity. There may be an exception for an assignment, a single call with a single arg.
|
||||||
|
Brackets without arguments look funny though.
|
||||||
|
|
||||||
### Hash
|
### Hash
|
||||||
|
|
||||||
I still prefer 1.9 => style , it makes the association more obvious.
|
I still prefer 1.9 => style , it makes the association more obvious.
|
||||||
@ -25,13 +31,8 @@ the code reads much nicer when they are on the module.
|
|||||||
|
|
||||||
### Code generators
|
### Code generators
|
||||||
|
|
||||||
Since code is represented by instances of Instructions (and subclasses) the most straightforward
|
|
||||||
way of generating code is by new of the Class. This is ok for some.
|
|
||||||
|
|
||||||
But often one finds a little massaging of the incoming data is better, while keeping that logic
|
|
||||||
out of the Instructions classes. In such cases Module functions are again quite nice. Example:
|
|
||||||
|
|
||||||
Instead of SlotToReg.new( register, index , register) we use Register.slot_to_reg( name , name , name).
|
Instead of SlotToReg.new( register, index , register) we use Register.slot_to_reg( name , name , name).
|
||||||
All names are resolved to registers, or index via Type. More readable code less repetition.
|
All names are resolved to registers, or index via Type. More readable code less repetition.
|
||||||
|
|
||||||
As the example shows, in this case the module function name should be the instruction class name.
|
As the example shows, in this case the module function name should be the instruction class name.
|
||||||
|
|
||||||
|
Singletons should hang off the module (not the class), eg Parfait.object_space
|
||||||
|
2
Gemfile
2
Gemfile
@ -6,7 +6,7 @@ gem "ast" , :github => "whitequark/ast" , branch: :master
|
|||||||
gem "rake"
|
gem "rake"
|
||||||
gem "rye"
|
gem "rye"
|
||||||
|
|
||||||
gem "salama-object-file" , :github => "salama/salama-object-file"
|
gem "salama-object-file" , :github => "ruby-x/salama-object-file"
|
||||||
#gem "salama-object-file" , :path => "../salama-object-file"
|
#gem "salama-object-file" , :path => "../salama-object-file"
|
||||||
|
|
||||||
gem "codeclimate-test-reporter", require: nil
|
gem "codeclimate-test-reporter", require: nil
|
||||||
|
15
README.md
15
README.md
@ -1,11 +1,12 @@
|
|||||||
[![Build Status](https://travis-ci.org/salama/salama.svg?branch=master)](https://travis-ci.org/salama/salama)
|
[![Build Status](https://travis-ci.org/ruby-x/salama.svg?branch=master)](https://travis-ci.org/ruby-x/salama)
|
||||||
[![Gem Version](https://badge.fury.io/rb/salama.svg)](http://badge.fury.io/rb/salama)
|
[![Gem Version](https://badge.fury.io/rb/salama.svg)](http://badge.fury.io/rb/salama)
|
||||||
[![Code Climate](https://codeclimate.com/github/salama/salama/badges/gpa.svg)](https://codeclimate.com/github/salama/salama)
|
[![Code Climate](https://codeclimate.com/github/ruby-x/ruby-x/badges/gpa.svg)](https://codeclimate.com/github/ruby-x/salama)
|
||||||
[![Test Coverage](https://codeclimate.com/github/salama/salama/badges/coverage.svg)](https://codeclimate.com/github/salama/salama)
|
[![Test Coverage](https://codeclimate.com/github/ruby-x/ruby-x/badges/coverage.svg)](https://codeclimate.com/github/ruby-x/salama)
|
||||||
|
|
||||||
# Salama
|
# RubyX
|
||||||
|
|
||||||
Salama is about native code generation in and of ruby.
|
RubyX is about native code generation in and of ruby. X can be read as 10 times faster,
|
||||||
|
or a decade away, depending on mindset.
|
||||||
|
|
||||||
The current (fourth) rewrite adds a typed intermediate representation layer (bit like c,
|
The current (fourth) rewrite adds a typed intermediate representation layer (bit like c,
|
||||||
but not as a language). The idea is to compile ruby to that typed representation.
|
but not as a language). The idea is to compile ruby to that typed representation.
|
||||||
@ -28,7 +29,7 @@ Completely object oriented, including calling convention. Not much slower than c
|
|||||||
### A runtime: Parfait
|
### A runtime: Parfait
|
||||||
|
|
||||||
In a dynamic system the distinction between compile-time and run-time is blurs. But a minimum
|
In a dynamic system the distinction between compile-time and run-time is blurs. But a minimum
|
||||||
of support is needed to get the system up, and that is [Parfait](http://salama-vm.org/soml/parfait.html)
|
of support is needed to get the system up, and that is [Parfait](http://ruby-x.org/soml/parfait.html)
|
||||||
|
|
||||||
### Interpreter
|
### Interpreter
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ register layer. That way test runs on the interpreter reveal most issues.
|
|||||||
|
|
||||||
### Debugger
|
### Debugger
|
||||||
|
|
||||||
And after the interpreter was done, i wrote a [visual debugger](https://github.com/salama/salama-debugger).
|
And after the interpreter was done, i wrote a [visual debugger](https://github.com/ruby-x/salama-debugger).
|
||||||
It is a simple opal application that nevertheless has proven great help both in figuring out
|
It is a simple opal application that nevertheless has proven great help both in figuring out
|
||||||
what is going on, and in finding bugs.
|
what is going on, and in finding bugs.
|
||||||
|
|
||||||
|
27
ToDo.md
27
ToDo.md
@ -1,26 +1,23 @@
|
|||||||
ToDo
|
ToDo
|
||||||
=====
|
=====
|
||||||
|
|
||||||
Some things that would be nice . . (if you did them :-) )
|
Some things that would be nice . .
|
||||||
|
|
||||||
- Better elf support. I think it should be relatively easy to produce an executable binary (so linking
|
- Better elf support. I think it should be relatively easy to produce an executable binary
|
||||||
could be skipped). Off course the possibility to link in another library would be nice
|
(so linking could be skipped). Off course the possibility to link in another library would be nice
|
||||||
|
- better elf tests
|
||||||
|
- better arm coverage (more instructions, better tests)
|
||||||
- utf8 support (string improvements generally)
|
- utf8 support (string improvements generally)
|
||||||
- SOF parser
|
|
||||||
|
|
||||||
Or the list of things i am not even planning of tackling at the moment
|
|
||||||
|
|
||||||
|
|
||||||
Platforms
|
Platforms
|
||||||
---------
|
---------
|
||||||
|
|
||||||
x86 is up for grabs. I have intentionally started on arm (the most sold cpu) because i do this for fun.
|
x86 is up for grabs. I have intentionally started on arm (the most sold cpu) because i do
|
||||||
And my pi is fun.
|
this for fun. And my pi is fun.
|
||||||
|
|
||||||
Trying to get mainstream acknowledgement/acceptence is not fun, it's hard work and should be undertaken by
|
There is a ruby intel assembler called wilson out there. Or then there is Metasm, with
|
||||||
someone with funding.
|
good support for many other cpu's (and a lot more code)
|
||||||
|
|
||||||
I hope to get the multi-machine architecture done at some point as i also want to port to Arduino
|
|
||||||
|
|
||||||
Compliance
|
Compliance
|
||||||
----------
|
----------
|
||||||
@ -38,4 +35,8 @@ Stdlib is not clean. More like a layer that accumulated over the years.
|
|||||||
Very nice solutions exist for most of the important things. Like celluloid for concurrency. Celluloid-io for
|
Very nice solutions exist for most of the important things. Like celluloid for concurrency. Celluloid-io for
|
||||||
good performance io with or without zero-mq. Fiddle looks nice admittedly.
|
good performance io with or without zero-mq. Fiddle looks nice admittedly.
|
||||||
|
|
||||||
Anyway, as i want to use gpio mostly the whole c wrapping is not too high on the list.
|
Interesting
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Solving concurrency is up for grabs. Any solution is a start, channels ala go are nice and
|
||||||
|
lock free stuff is the ultimate goal.
|
||||||
|
@ -13,6 +13,6 @@ A normal ruby function is one that is parsed and transformed to code. But not al
|
|||||||
be written in ruby, one of those chicken and egg things.
|
be written in ruby, one of those chicken and egg things.
|
||||||
C uses Assembler in this situation, we use Builtin functions.
|
C uses Assembler in this situation, we use Builtin functions.
|
||||||
|
|
||||||
Slightly more here : http://salama.github.io/2014/06/10/more-clarity.html (then still called Kernel)
|
Slightly more here : http://ruby-x.org/2014/06/10/more-clarity.html (then still called Kernel)
|
||||||
|
|
||||||
The Builtin module is scattered into several files, but that is just so the file doesn't get too long.
|
The Builtin module is scattered into several files, but that is just so the file doesn't get too long.
|
||||||
|
@ -9,8 +9,8 @@ And a large part of that functionality must actually be used at compile time too
|
|||||||
We reuse the Parfait code at compile-time, to create the data for the compiled vm.
|
We reuse the Parfait code at compile-time, to create the data for the compiled vm.
|
||||||
To do this the vm (re) defines the object memory (in parfait_adapter).
|
To do this the vm (re) defines the object memory (in parfait_adapter).
|
||||||
|
|
||||||
A work in progress that started from here : http://salama.github.io/2014/06/10/more-clarity.html
|
A work in progress that started from here : http://ruby-x.org/2014/06/10/more-clarity.html
|
||||||
went on here http://salama.github.io/2014/07/05/layers-vs-passes.html
|
went on here http://ruby-x.org/2014/07/05/layers-vs-passes.html
|
||||||
|
|
||||||
A step back: the code (program) we compile runs at run - time.
|
A step back: the code (program) we compile runs at run - time.
|
||||||
And so does parfait. So all we have to do is compile it with the program.
|
And so does parfait. So all we have to do is compile it with the program.
|
||||||
|
@ -54,7 +54,7 @@ module Parfait
|
|||||||
# This is the crux of the object system. The class of an object is stored in the objects
|
# This is the crux of the object system. The class of an object is stored in the objects
|
||||||
# memory (as opposed to an integer that has no memory and so always has the same class)
|
# memory (as opposed to an integer that has no memory and so always has the same class)
|
||||||
#
|
#
|
||||||
# In Salama we store the class in the Type, and so the Type is the only fixed
|
# In RubyX we store the class in the Type, and so the Type is the only fixed
|
||||||
# data that every object carries.
|
# data that every object carries.
|
||||||
def get_class()
|
def get_class()
|
||||||
l = get_type()
|
l = get_type()
|
||||||
|
@ -8,10 +8,10 @@ Gem::Specification.new do |s|
|
|||||||
s.email = 'torsten@villataika.fi'
|
s.email = 'torsten@villataika.fi'
|
||||||
s.extra_rdoc_files = ['README.md']
|
s.extra_rdoc_files = ['README.md']
|
||||||
s.files = %w(README.md LICENSE.txt Rakefile) + Dir.glob("lib/**/*")
|
s.files = %w(README.md LICENSE.txt Rakefile) + Dir.glob("lib/**/*")
|
||||||
s.homepage = 'https://github.com/salama/salama'
|
s.homepage = 'https://github.com/ruby-x/salama'
|
||||||
s.license = 'MIT'
|
s.license = 'MIT'
|
||||||
s.require_paths = ['lib']
|
s.require_paths = ['lib']
|
||||||
s.summary = 'Salama is a native object vm without any c, one day possibly a ruby vm'
|
s.summary = 'RubyX is a native object vm without any c, one day possibly a ruby vm'
|
||||||
|
|
||||||
s.add_dependency "parser" , "~> 2.3.0"
|
s.add_dependency "parser" , "~> 2.3.0"
|
||||||
s.add_dependency "salama-object-file" , "~> 0.3"
|
s.add_dependency "salama-object-file" , "~> 0.3"
|
@ -67,7 +67,7 @@ module RuntimeTests
|
|||||||
return unless box = connected
|
return unless box = connected
|
||||||
load_program
|
load_program
|
||||||
file = write_object_file
|
file = write_object_file
|
||||||
r_file = file.sub("./" , "salama/")
|
r_file = file.sub("./" , "ruby-x/")
|
||||||
box.file_upload file , r_file
|
box.file_upload file , r_file
|
||||||
print "\nfile #{file} "
|
print "\nfile #{file} "
|
||||||
return if dont_run
|
return if dont_run
|
||||||
|
@ -19,7 +19,7 @@ class TestRunner < MiniTest::Test
|
|||||||
|
|
||||||
def execute file
|
def execute file
|
||||||
string = File.read(file)
|
string = File.read(file)
|
||||||
parser = Parser::Salama.new
|
parser = Parser::RubyX.new
|
||||||
object_space = Register::Program.new "Arm"
|
object_space = Register::Program.new "Arm"
|
||||||
#TODO : files would have to include s-expressions now
|
#TODO : files would have to include s-expressions now
|
||||||
syntax = parser.parse_with_debug(string, reporter: Parslet::ErrorReporter::Deepest.new)
|
syntax = parser.parse_with_debug(string, reporter: Parslet::ErrorReporter::Deepest.new)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user