adding some texts and made jekyl frame
This commit is contained in:
34
_posts/2014-04-10-official-start.md
Normal file
34
_posts/2014-04-10-official-start.md
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
layout: news
|
||||
author: Torsten
|
||||
---
|
||||
|
||||
Well, it has been a good holiday, two months in Indonesia, Bali and diving Komodo. It brought clarity, and so
|
||||
i have to start a daunting task.
|
||||
|
||||
When i learned programming at University, they were still teaching Pascal. So when I got to choose c++ in my first
|
||||
bigger project that was a real step up. But even i wrestled templates, it was Smalltalk that took my heart
|
||||
immediately when i read about it. And I read quite a bit, including the Blue Book about the implementation of it.
|
||||
|
||||
The next disctinct step up was Java, in 1996, and then ruby in 2001. Until i mostly stopped coding in 2004 when i
|
||||
moved to the country side and started our <a href="http://villataika.fi/en/index.html"> B&B </a>
|
||||
But then we needed web-pages, and before long a pos for our shop, so i was back on the keyboard. And since it was
|
||||
a thing i had been wanting to do, I wrote a database.
|
||||
|
||||
Purple was my current idea of an ideal data-store. Save by reachability, automatic loading by traversal
|
||||
and schema-free any ruby object saving. In memory, based on Judy, it did about 2000 transaction per second.
|
||||
Alas, it didn't have any searching.
|
||||
|
||||
So i bit the bullet and implemented an sql interface to it. After a failed attempt with rails 2 and after 2 major rewrites
|
||||
i managed to integrate what by then was called warp into Arel (rails3).
|
||||
But while raw throughput was still about the same, when
|
||||
it had to go through Arel it crawled to 50 transactions per second, about the same as sqlite.
|
||||
|
||||
This was maybe 2011, and there was not doubt anymore. Not the database, but ruby itself was the speed hog. I aborted.
|
||||
|
||||
In 2013 I bought a Raspberry Pi and off course I wanted to use it with ruby. Alas... Slow pi + slow ruby = nischt gut.
|
||||
I gave up.
|
||||
|
||||
So then the clarity came with the solution, build your own ruby. I started designing a bit on the beach already.
|
||||
Still, daunting. But maybe just possible....
|
||||
|
20
_posts/2014-04-24-asm-out.md
Normal file
20
_posts/2014-04-24-asm-out.md
Normal file
@ -0,0 +1,20 @@
|
||||
---
|
||||
layout: news
|
||||
author: Torsten
|
||||
---
|
||||
|
||||
Part of the reason why i even thougth this was possible was because i had bumped into Metasm.
|
||||
|
||||
Metasm creates native code in 100% ruby. Either from Assembler or even C (partially). And for many cpu's too.
|
||||
It also creates many binary formats, elf among them.
|
||||
|
||||
Still, i wanted something small that i could understand easily as it was clear it would have to be changed to fit.
|
||||
As there was no external assembler file format planned, the whole aproach from parsing was inapropriate.
|
||||
|
||||
I luckily found a small library, as, that did arm only and was just a few files. After removing not needed parts
|
||||
like parsing and some reformatting i added an assmbler like dsl.
|
||||
|
||||
This layer (arm subdirectory) said hello after about 2 weeks of work.
|
||||
|
||||
I also got qemu to work and can thus develop without the actual pi.
|
||||
|
29
_posts/2014-05-20-first-fibo.md
Normal file
29
_posts/2014-05-20-first-fibo.md
Normal file
@ -0,0 +1,29 @@
|
||||
---
|
||||
layout: news
|
||||
author: Torsten
|
||||
---
|
||||
Both "ends", parsing and machine code, were relatively clear cut. Now it is into unknown territory.
|
||||
|
||||
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.
|
||||
|
||||
In the end, or rather now, it is that 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
|
||||
dependant code possible. So far so ok.
|
||||
|
||||
Register allocation was (and is) another story. Argument passing and local variables do work now, but there is definately
|
||||
room for improvement there.
|
||||
|
||||
To get anything out of a running program i had to implement putstring (easy) and putint (difficult). Surprisingly
|
||||
division is not easy and when pinned to 10 (divide by 10) quite strange. Still it works. While i was at writing
|
||||
assmbler i found a fibonachi in 10 or so instructions.
|
||||
|
||||
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!
|
35
_posts/2014-05-6-first-parses.md
Normal file
35
_posts/2014-05-6-first-parses.md
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
layout: news
|
||||
author: Torsten
|
||||
---
|
||||
|
||||
Parsing is a difficult, the theory incomprehensible and older tools cryptic. At least for me.
|
||||
|
||||
And then i heard recursive is easy and used by even llvm. Formalised as peg parsing libraries exists, and in ruby
|
||||
they have dsl's and are suddenly quite understandable.
|
||||
|
||||
Off the candidates i had first very positive experiences with treetop. Upon continuing i found the code
|
||||
generation aspect not just clumbsy (after all you can define methods in ruby), but also to interfere unneccessarily
|
||||
with code control. On top of that conversion into an AST was not easy.
|
||||
|
||||
After looking around i found Parslet, which pretty much removes all those issues. Namely
|
||||
|
||||
- It does not generate code, it generates methods. And has a nice dsl.
|
||||
- It transforms to ruby basic types and has the notion on a transormation.
|
||||
So an easy and clean way to create an AST
|
||||
- One can use ruby modules to partition a larger parser
|
||||
- Minimal dependencies (one file).
|
||||
- Active use and development.
|
||||
|
||||
So i was sold, and i got up to speed quite quickly. But i also found out how fiddly such a parser is in regards
|
||||
to ordering and whitespace.
|
||||
|
||||
I spent some time to make quite a solid test framework, testing the differnet rules seperately and also the
|
||||
stages seperately, so things would not break accidentally when growing.
|
||||
|
||||
After about another 2 weeks i was able to parse functions, both calls and definitions, ifs and whiles and off course basic
|
||||
types of integers and strings.
|
||||
|
||||
With the great operator support it was a breeze to create all 15 ish binary operators. Even Array and Hash constant
|
||||
definition was very quick. All in all surprisingly painless, thanks to Kasper!
|
||||
|
Reference in New Issue
Block a user