diff --git a/_posts/2014-05-20-first-fibo.md b/_posts/2014-05-20-first-fibo.md index 7a90e2c..6763a43 100644 --- a/_posts/2014-05-20-first-fibo.md +++ b/_posts/2014-05-20-first-fibo.md @@ -7,9 +7,9 @@ Both "ends", parsing and machine code, were relatively clear cut. Now it is into I had ported the Kaleidescope llvm tutorial language to ruby-llvm last year, so thee were some ideas floating. The idea of basic blocks, as the smallest unit of code without branches was pretty clear. Using those as jump -targets was also straight forward. But how to get fromthe AST to arm Intructions was not, and took some trying out. +targets was also straight forward. But how to get from the AST to arm Intructions was not, and took some trying out. -In the end, or rather now, it is that AST layer that "compiles" itself into the Vm layer. The Vm layer then assembles +In the end, or rather now, it is the AST layer that "compiles" itself into the Vm layer. The Vm layer then assembles itself into Instructions. General instructions are part of the Vm layer, but the code picks up derived classes and thus makes machine @@ -26,4 +26,4 @@ To summarise, function definition and calling (including recursion) works. If and and while structures work and also some operators and now it's easy to add more. So we have a Fibonacchi in ruby using a while implementation that can be executed by crystal and outputs the - correct result. After a total of 7 weeks this is much further than expected! + correct result. After a total of 7 weeks this is much more than expected! diff --git a/about.html b/about.html new file mode 100644 index 0000000..6586cb5 --- /dev/null +++ b/about.html @@ -0,0 +1,136 @@ +--- +layout: site +title: Crystal, where it started +--- + + +
+
+

+

+
+
+ +
+
 
+
+

+ Torsten Ruger started this on 10.04.2014 after having read the Blue Book 20 years earlier. + The main ideas were: +

+

+ Mikrokernel: The microkernel idea: anything that can be left out, should, puts a nice upper limit + on things and at the same time provides a great cooking pot for everyone else to try out their ideas.
+ Given gems and bundler this also seems an obvious choice. I really hope to see things i hadn't even thought of. +
+ Layers represent an interface, not an implementation: + It is said that every problem in computing can be solved by adding anohter layer of indirection. And so + we have many layers, which, when done right, help us to understand the system. (Read, layers are for us, + not the computer) + But implementing each layer comes with added cost, often unneccessary. Layers can and should be collapsed + in the implementation. Inlining, is a good example of this. +
+ Empowerment: I like the openness of ruby. Everyone can do what and how they want. And change other + peoples code in an easy and sensible way. The best ideas survive and even better ones are coming. + Friendly competition as it were, cooperation, independant improvement all make ruby gems better all the time.
+ But ruby itself has not benefited from this in the same way (ie by ruby developers), because it is not in ruby. +
+ To get it done: I don't know why this has not been done before, it seems so obvious. + The Blue Book influence has left me interested in virtual machines and that hasn't gone away for + so long. So when i bought my raspberry pi and had a real need for speed, the previous ecommerce project + left me feeling that anything could be done. And so i started. +
+

+
+
+ + + +
+
+

Thanks

+

This would not have happened without:

+
+
+ + +
+
+

Smalltalk

+

+ Smalltalk is the mother of OO for me. Adele Goldberg has written down the details of early implementations in the + Blue Book, which made a great impression on me. Having read it mri code is quite easy to understand.
+ Unfortunately Smalltalk was too far ahead of it's time and used the image, the implications of which are still + not understood imho.
+ Additional bad luck struck when, in Steven Jobs great heist of the PARC UI, he did not recognise the value of it's + implementation language and so Smalltalk did not get the same boost as the gui. +

+
+ +
+

Ruby and Rails

+

+ After years of coding Java, Ruby was a very fresh wind. Smalltalk reborn without the funny syntax or image. + Instead of the image we now have gems, git and bundler, so code exchange has never been easier. +

+

+ Rails has sort of given Ruby it's purpose and made it grow from a perl like scripting language to a server programming + environment with all the whistle and bells. Rails maturity and code quality make it not only a joy to use, + but an excellent source for good ruby practises. +

+

+

+
+ +
+

Synthesis

+

Synthesis is a microkernel OS written + in the 80's by Alexia Massalin which not only proves the validity of the microkernel idea, but also + introduces self modufying code into, of all places, the OS. +

+

+ Alexia has raised questions about the nature of code and ways of programming which are still unresolved. + I regularly reread the thesis and especially the chapter on + Quajects in the endeavour to understand what + they are in any higher language terms. +

+
+
+ + +
+
+

Many other steps on the way that have left their mark:

+
+
+ +
+
 
+
+

+ Judy has been a major source of inspiration and opened new + ways of thinking about data structures and indeed coding. It has been the basis of two databases i wrote and together + with Synthesis redefined the meaning of speed for me. +

+

+ Metasm finally confirmed what i had suspected for a while. + Namely that you don't need C to generate (machine) code. Metasm has be been assmbling, deassembling and + compiling for several cpu's since 2007, in 100% ruby. + A great feat, and the only reason i don't use it is because it is too big (for now). +

+

+ As ended up being the starting point for the assembly layer. + It was nice and small and produced working ARM code, which is what i wanted, as raspberry is arm. + Wilson got assimilated for similar reasons, ie small and + no dependencies. +

+

+ Parslet is great, thanks Kasper! Parslet makes + parsing possible for everyone. +

+

+ Bundler just makes you wonder how we managed before. Thanks to Yahuda, also for merb, which is not + forgotten, and thor. +

+
+
diff --git a/index.html b/index.html new file mode 100755 index 0000000..6a2f884 --- /dev/null +++ b/index.html @@ -0,0 +1,88 @@ +--- +layout: site +title: Ruby in Ruby is 100% ruby +--- + + +
+
+

Ruby in Ruby. With more ruby and nothing but ruby.

+

"Hey crystal, what do you want to be when you grow up". I like pink, i wanna be a ruby.

+
+
+ +
+
+

Ruby in ruby hopes make the the mysterious more accessible, shed light in the farthest (ruby) corners, and above all, empower you

+
+
+

Three ideas are behind it

+
+
+ +
+
+

A better tool, a better job

+

+ Ruby is the better tool to do the job. Any software job that is. We who use ruby daily do so because it is + more productive, better in almost every way. The only downside is speed and we argue that with cheap resources. +

+

+ Why it has taken this long to even seriously attempt a ruby implementation in ruby is due to the overwhelming + influence of C (folks). +

+

+ Just a short and subjective list of why ruby is the better tool: +

+

+
+ +
+

Use the Rails effect

+

+ Rails has evolved tremendously from what was already a good start. All the development around it has nurtured + ruby developement in all areas. Rails and all those parts make up the most mature and efficient software system + i know. +

+

The rails effect is due to the accessibility of the system, imho. Ie it is written in ruby.

+

Ruby itself has not enjoyed this rails effect, and that is because it is written in C (or c++)

+

It is my firm belief that given a vm in ruby, ruby development will "take off" too. In other words, given an + easy way to improve his tools, a developer will do so. Easy means understandable and that means ruby for a + ruby developer +

+
+ +
+

Mature

+

+ The first thing any decent comiler does, is compile itself. It is the maturity test of a language to implement + itself in itself, and it is time for ruby. +

+

+ Having just learned Assembler, which i have successfully avoided for 30 years, i can attest what a great improvement C + is over Assembler. But that was then and it is not just chance that developemnt has been little in the last 50 years. +

+

+ There is this attitude C believers elude and since they are the gatekeepers of the os, + everyone is fooled into believing only c is fast. Whereas what is true is that static code is fast. +

+

+ On a very similar note there we are lead to believe that os features must be used from c. Whereas system calls + are software interrupts and only the c std library makes them look like c functions. But they are not. +

+

+ So now, are we ready to generate some bytes? even if they are Machine Code. And go to the Source? I say we are! +

+
+
+ + + + + diff --git a/what_is.html b/what_is.html new file mode 100644 index 0000000..0d70c44 --- /dev/null +++ b/what_is.html @@ -0,0 +1,64 @@ +--- +layout: site +title: Crystal +--- + + + +
+
+ +
+
+
+
+

The three Rubies

+
+
+

and Crystal

+
+
+ +
+
+

Syntax

+
and meaning
+

Pure OO, blocks, closures, often no need for braces, simple but consistant, open classes

+

Just to name a few of the great features of the ruby syntax and it's programming model.
+ Syntax is an abstract thing, as far as i know there is no ebnf or similar definition of it. + Also as far as i know there is only the mri is considered (by matz and co) the only source of how ruby works.
+ With more vm's appearing this is changing and the mpsec is apparently catching up.
+ As we are just starting we focus on oo consistency and implement only essential features. +

+
+ +
+

Vm

+
Crystal
+

The heart of the ruby-in-ruby project is crystal, the virtual machine

+

Crystal is written in 100% ruby

+

Crystal uses an existing ruby to bootstrap itself

+

Crystal generates native code, and ( with 1+2) creates a native ruby (virtual) machine that is able to + generate code on the fly and thus alter itself.

+

Crystal does not interpret, it parses and compiles (just making sure that's clear)

+
+ +
+

Core - Library

+
Parfait
+

Ruby has core and std lib, with a slightly unclear distinction. + Parfait is a minimalistic core library on which this could be built. +

+

+ Stdlib, as Libc , have grown over the decades to provide overlapping and sometimes inconsistant features, most + of which can and should be outside such a standard component. +

+

Crystal considers only that core which can not be suplied though an external gem, this is called + Parfait. It only provides Array and String and an ability to access + the operating system, in 100% ruby.

+

Full ruby stdlib compliance is not an initial project goal, but may be achieved through external libraries

+
+ +
+
+