update the readme a bit, since there is actual progress
This commit is contained in:
parent
ee864fc602
commit
c7d203f523
@ -3,8 +3,8 @@ Crystal
|
|||||||
|
|
||||||
Crystal is about native code generation in and of ruby. In is done.
|
Crystal is about native code generation in and of ruby. In is done.
|
||||||
|
|
||||||
Step 1
|
Step 1 - Assembly
|
||||||
------
|
-----------------
|
||||||
|
|
||||||
Produce binary that represents code.
|
Produce binary that represents code.
|
||||||
Traditionally called assembling, but there is no need for an external file representation.
|
Traditionally called assembling, but there is no need for an external file representation.
|
||||||
@ -27,58 +27,95 @@ I even polished the dsl an so (from the tests), this is a valid hello world:
|
|||||||
end
|
end
|
||||||
write(7 + hello.length/4 + 1 , 'hello')
|
write(7 + hello.length/4 + 1 , 'hello')
|
||||||
|
|
||||||
Step 2
|
Step 2 -Link to system
|
||||||
------
|
----------------------
|
||||||
|
|
||||||
Package the code into an executable. Run that and verify it's output. But full elf support (including externs) is eluding me for now.
|
Package the code into an executable. Run that and verify it's output. But full elf support (including externs) is eluding me for now.
|
||||||
|
|
||||||
Still, this has proven to be a good review point for the arcitecture and means no libc for now.
|
Still, this has proven to be a good review point for the arcitecture and means no libc for now.
|
||||||
Full rationale on the web (pages rep for now), but it means starting an extra step
|
Full rationale on the web (pages rep for now), but it means starting an extra step
|
||||||
|
|
||||||
Above Hello World can ne linked and run. And will say its thing.
|
Above Hello World can be linked and run. And will say its thing.
|
||||||
|
|
||||||
Step 2.1
|
Step 2.1 -syscalls
|
||||||
--------
|
------------------
|
||||||
|
|
||||||
Start implementing syscalls and add the functionality we actually need from c (basic io only really)
|
Start implementing some syscalls and add the functionality we actually need from c (basic io only really)
|
||||||
|
|
||||||
Step 3
|
Step 3 -Parse ruby
|
||||||
-------
|
------------------
|
||||||
|
|
||||||
Start parsing some simple code. Using Parslet.
|
Parse simple code, using Parslet.
|
||||||
|
|
||||||
This is where it is at. Simple things transform nicely with parslet.
|
Parsing is a surprisingly fiddly process, very space and order sensitive. But Parslet is great and simple
|
||||||
|
expressions (including function definitions and calls) are starting to work.
|
||||||
|
|
||||||
But the glue is eluding me.
|
I Spent some time on the parse testing framework, so it is safe to fiddle and add.
|
||||||
|
|
||||||
Get the parse - compile - execute -verify cycle going.
|
Step 4 - Vm: Compile the Ast
|
||||||
|
---------------------------
|
||||||
|
|
||||||
Step 4
|
Since we now have an Abstact syntax tree, it needs to be compiled to a machine Instruction format.
|
||||||
-------
|
|
||||||
|
|
||||||
Implement function calling to modularise.
|
The machine/instruction/data definitions make up the Virtual Machine layer (vm directory)
|
||||||
Implement a way to call libc
|
|
||||||
|
|
||||||
Step 5
|
After some trying around, something has emerged. As it uses the instructions from Step 1, we are ready to say
|
||||||
------
|
our hellos in ruby
|
||||||
|
|
||||||
Implement classes, implement Core library of arrays/hash
|
puts("Hello World")
|
||||||
|
|
||||||
Step 6
|
was the first to make the trip: parsed to ast, compiled to Instructions/Code, linked and assembled to binary
|
||||||
------
|
and executed, gives the surprising output of "Hello World"
|
||||||
|
|
||||||
Implement Blocks
|
Time to add some meat.
|
||||||
|
|
||||||
Step 7
|
Step 5 - Register allocation
|
||||||
------
|
----------------------------
|
||||||
|
|
||||||
Implement Exceptions
|
Unfortunately Hello world cheated a little in that it assumed knowledge of registers. Next up is a dynamic
|
||||||
|
algorithm for register allocation.
|
||||||
|
|
||||||
|
Probably using something along llvm lines (again!), ie Instructions refering to the Values theu use.
|
||||||
|
Ravel the chain up from the back, ie where things have to be at the end to make it work.
|
||||||
|
|
||||||
|
Step 6 - Basic type instructions
|
||||||
|
--------------------------------
|
||||||
|
|
||||||
|
As we want to work on values, all the value methods have to be implemented to map to machine instructions.
|
||||||
|
|
||||||
|
With optimisations there are so many!!
|
||||||
|
|
||||||
|
Step 7 - Compound types
|
||||||
|
-----------------------
|
||||||
|
|
||||||
|
Your basic array and hash need to be parsed , and implemented along with string. Nothing much happens without
|
||||||
|
these guys.
|
||||||
|
|
||||||
Step 8
|
Step 8
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
Implement a way to call libc
|
||||||
|
|
||||||
Celebrate New year 2020
|
Step 9
|
||||||
|
------
|
||||||
|
|
||||||
|
Implement classes, implement Core library of arrays/hash
|
||||||
|
|
||||||
|
Step 10
|
||||||
|
------
|
||||||
|
|
||||||
|
Implement Blocks
|
||||||
|
|
||||||
|
Step 11
|
||||||
|
------
|
||||||
|
|
||||||
|
Implement Exceptions
|
||||||
|
|
||||||
|
Step 12
|
||||||
|
-------
|
||||||
|
|
||||||
|
|
||||||
|
Celebrate New year 2030
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user