some more text and small corrections

This commit is contained in:
Torsten Ruger 2014-05-26 22:13:49 +03:00
parent 7ce9c03353
commit 14f0e96e3d
4 changed files with 291 additions and 3 deletions

View File

@ -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!

136
about.html Normal file
View File

@ -0,0 +1,136 @@
---
layout: site
title: Crystal, where it started
---
<!-- story -->
<div class="row vspace20">
<div class="span12 center">
<h1><span></span></h1>
<p></p>
</div>
</div>
<div class="row ">
<div class="span1"> &nbsp; </div>
<div class="span10">
<p>
Torsten Ruger started this on 10.04.2014 after having read the Blue Book 20 years earlier.
The main ideas were:
</p>
<p>
<b>Mikrokernel</b>: 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.<br/>
Given gems and bundler this also seems an obvious choice. I really hope to see things i hadn't even thought of.
<br/>
<b>Layers represent an interface, not an implementation</b>:
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.
<br/>
<b>Empowerment</b>: 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.<br/>
But ruby itself has not benefited from this in the same way (ie by ruby developers), because it is not in ruby.
<br/>
<b>To get it done</b>: 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.
<br/>
</p>
</div>
</div>
<div class="row vspace20">
<div class="span12 center">
<h1><span>Thanks</span></h1>
<p>This would not have happened without:</p>
</div>
</div>
<!-- About Us -->
<div class="row vspace20">
<div class="span4">
<h2 class="center">Smalltalk</h2>
<p>
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. <br/>
Unfortunately Smalltalk was too far ahead of it's time and used the image, the implications of which are still
not understood imho.<br/>
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.
</p>
</div>
<div class="span4">
<h2 class="center">Ruby and Rails</h2>
<p>
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.
</p>
<p>
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.
</p>
<p>
</p>
</div>
<div class="span4">
<h2 class="center">Synthesis</h2>
<p>Synthesis</a> 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.
</p>
<p>
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
<a href="http://valerieaurora.org/synthesis/SynthesisOS/ch4.html"> Quajects </a> in the endeavour to understand what
they are in any higher language terms.
</p>
</div>
</div>
<div class="row vspace20">
<div class="span12 center">
<p>Many other steps on the way that have left their mark:</p>
</div>
</div>
<div class="row ">
<div class="span1"> &nbsp; </div>
<div class="span10">
<p>
<b><a href="http://judy.sourceforge.net/">Judy</a></b> 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.
</p>
<p>
<b><a href="http://metasm.cr0.org/">Metasm</a></b> 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).
</p>
<p>
<b><a href="https://github.com/cyndis/as">As</a></b> 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.
<b><a href="https://github.com/seattlerb/wilson"> Wilson </a> </b>got assimilated for similar reasons, ie small and
no dependencies.
</p>
<p>
<b><a href="http://kschiess.github.io/parslet/">Parslet</a></b> is great, thanks Kasper! Parslet makes
parsing possible for everyone.
</p>
<p>
<b>Bundler</b> just makes you wonder how we managed before. Thanks to Yahuda, also for merb, which is not
forgotten, and thor.
</p>
</div>
</div>

88
index.html Executable file
View File

@ -0,0 +1,88 @@
---
layout: site
title: Ruby in Ruby is 100% ruby
---
<!-- Pay Off -->
<div class="row center vspace10">
<div class="span12">
<h1><span>Ruby in Ruby. With more ruby and nothing but ruby.</span></h1>
<p>"Hey crystal, what do you want to be when you grow up". I like pink, i wanna be a ruby.</p>
</div>
</div>
<div class="row center vspace10">
<div class="span12">
<p><span>Ruby in ruby hopes make the the mysterious more accessible, shed light in the farthest (ruby) corners, and above all, <b>empower you</b> </span></p>
</div>
<div class="span12">
<p><span>Three ideas are behind it</span></p>
</div>
</div>
<div class="row vspace20">
<div class="span4">
<h2 class="center"> A better tool, a better job</h2>
<p>
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.
</p>
<p>
Why it has taken this long to even seriously attempt a ruby implementation in ruby is due to the overwhelming
influence of C (folks).
</p>
<p>
Just a short and subjective list of why ruby is the better tool:
<ul>
<li>More fun. Ask anyone</li>
<li>Lets you focuss on the task</li>
<li>Elegant, both in syntax and solution</li>
<li>Understandable</li>
<li>Much faster to code</li>
</ul>
</p>
</div>
<div class="span4">
<h2 class="center">Use the Rails effect</h2>
<p>
Rails has evolved tremendously from what was already a good start. All the development <em>around</em> it has nurtured
ruby developement in all areas. Rails and all those parts make up the most mature and efficient software system
i know.
</p>
<p> The rails effect is due to the accessibility of the system, imho. Ie it is written in ruby.</p>
<p> Ruby itself has not enjoyed this rails effect, and that is because it is written in C (or c++) </p>
<p> 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
</p>
</div>
<div class="span4">
<h2 class="center">Mature</h2>
<p>
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.
</p>
<p>
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.
</p>
<p>
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 <em>static</em> code is fast.
</p>
<p>
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.
</p>
<p>
So now, are we ready to generate some bytes? even if they are Machine Code. And go to the Source? I say we are!
</p>
</div>
</div>

64
what_is.html Normal file
View File

@ -0,0 +1,64 @@
---
layout: site
title: Crystal
---
<div class="content">
<div class="container theme">
<div class="row vspace30">
<div class="span2 center">
</div>
<div class="span4 center">
<h3><span>The three Rubies</span></h3>
</div>
<div class="span4 center">
<h3><span>and Crystal</span></h3>
</div>
</div>
<div class="row vspace10">
<div class="span4">
<h4>Syntax</h4>
<h5>and meaning</h5>
<blockquote><p> Pure OO, blocks, closures, often no need for braces, simple but consistant, open classes<br/></p></blockquote>
<p> Just to name a few of the great features of the ruby syntax and it's programming model. <br/>
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. <br/>
With more vm's appearing this is changing and the mpsec is apparently catching up. <br/>
As we are just starting we focus on oo consistency and implement only essential features.
</p>
</div>
<div class="span4">
<h4>Vm</h4>
<h5>Crystal</h5>
<blockquote><p> The heart of the ruby-in-ruby project is crystal, the virtual machine <br /></p></blockquote>
<p>Crystal is written in 100% ruby</p>
<p>Crystal uses an existing ruby to bootstrap itself</p>
<p>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.</p>
<p>Crystal does not interpret, it parses and compiles (just making sure that's clear)</p>
</div>
<div class="span4">
<h4>Core - Library </h4>
<h5>Parfait</h5>
<blockquote><p> Ruby has core and std lib, with a slightly unclear distinction.
Parfait is a minimalistic core library on which this could be built.
</p></blockquote>
<p>
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.
</p>
<p> 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.</p>
<p>Full ruby stdlib compliance is not an initial project goal, but may be achieved through external libraries</p>
</div>
</div>
</div>
</div>