diff --git a/app/assets/images/layers.jpg b/app/assets/images/layers.jpg
index 63e69ae..3fd1218 100644
Binary files a/app/assets/images/layers.jpg and b/app/assets/images/layers.jpg differ
diff --git a/app/assets/layers.uxf b/app/assets/layers.uxf
index e649d3f..0869ad3 100644
--- a/app/assets/layers.uxf
+++ b/app/assets/layers.uxf
@@ -24,7 +24,7 @@ Concrete Tree
<Ruby>
--
-Abstract Tree
+Concrete Tree
@@ -37,8 +37,7 @@ Abstract Tree
<Mom>
--
-Concrete Tree
-+ Linked List
+Linked List
@@ -47,7 +46,7 @@ Concrete Tree
60
250
120
- 50
+ 60
<Risc>
--
@@ -58,7 +57,7 @@ Linked List
UMLClass
60
- 300
+ 310
120
50
@@ -71,13 +70,13 @@ Linked List
UMLClass
60
- 350
+ 360
120
- 50
+ 60
<Elf>
--
-Binary / Array
+Parfait + Binary
@@ -85,11 +84,11 @@ Binary / Array
220
70
- 670
+ 730
60
- Ruby is parsed into and abstract syntax tree. "Abstract" means all nodes are
-represented by one class. Compiling to Vool happens by visitor pattern.
+ A Ruby layer modelled after the ast. This layer transforms ruby into the lower Vool
+layer, to simplify the input.
@@ -97,12 +96,12 @@ represented by one class. Compiling to Vool happens by visitor pattern.
220
130
- 670
+ 730
60
Vool (Virtual object oriented Language) is ruby without the fluff. Just simple oo.
-Vool uses a concrete syntax tree, meaning one class per kind of statement.
-Code to compile to Mom is in the statement classes.
+Vool also uses a concrete syntax tree, meaning one class per kind of statement.
+Vool is tranforms into Mom Instructions.
@@ -111,12 +110,12 @@ Code to compile to Mom is in the statement classes.
220
190
- 670
+ 730
60
- Mom (Minimal object machine) is a very simple object oriented machine. It only deals in objects,
-incuding the calling convention. A first pass still uses a tree structure to represent control.
-The final representation is a list of instructions.
+ Mom (Minimal object machine) is a very simple object oriented machine. This means it has Instructions
+that get executed, and form a Linked List. It only deals in objects, incuding the calling convention.
+It transforms into Risc in a simple 1 to n manner.
@@ -124,19 +123,20 @@ The final representation is a list of instructions.
220
250
- 670
- 50
+ 730
+ 60
- The Risc (reduced intruction set computer) layer is an (sane) subset of ARM. It models only those
-instructions needed to implement Mom, about 20. It deals in memory, logic and jumps.
+ The Risc (reduced intruction set computer) layer is a (sane) subset of ARM. It models only those
+instructions needed to implement Mom, about 20. It deals in memory, logic and jumps, and has registers.
+Transformation into ARM is mostly one to one.
UMLClass
220
- 300
- 670
+ 310
+ 730
50
The arm chip is the most sold/used in the world, so it is our first "target". Arm has a simple
@@ -147,12 +147,38 @@ instruction set and we only use the part to implement what is used in Risc.UMLClass
220
- 350
- 670
- 50
+ 360
+ 730
+ 60
The lowest level, achieved by assembling arm instructions, is binary code that a cpu can execute.
-Elf is used to wrap it into a file so Linux can start it. Elf includes debug info too.
+The Binary is stored as Parfait objects that are then wrapped into Elf.
+A simple (non-c) Elf file is created so Linux can start it.
+
+
+
+ UMLClass
+
+ 60
+ 10
+ 120
+ 60
+
+ <Parser>
+--
+Abstract Tree
+
+
+
+ UMLClass
+
+ 220
+ 10
+ 730
+ 60
+
+ Ruby is parsed into and abstract syntax tree. "Abstract" means all nodes are
+represented by one class. This is implemented by the parser gem.
diff --git a/app/views/pages/rubyx/layers.html.haml b/app/views/pages/rubyx/layers.html.haml
index b325728..66ff58d 100644
--- a/app/views/pages/rubyx/layers.html.haml
+++ b/app/views/pages/rubyx/layers.html.haml
@@ -11,12 +11,12 @@
ruby. The argument is often made that
typed languages are faster, but i don’t believe in that. I think dynamic languages
just push more functionality into the “virtual machine” and it is in fact only the
- compiling to binaries that gives static languages their speed. This is the reason
+ compilation to binaries that gives static languages their speed. This is the reason
to compile ruby.
%p.center
= image_tag "layers.jpg" , alt: "Architectural layers"
-%h3#ruby Ruby
+%h3#ruby Ast + Ruby
%p
To compile and run ruby, we first need to parse ruby. While parsing ruby is quite
a difficult task, it has already been implemented in pure ruby
@@ -27,15 +27,15 @@
%em Node
class.
Nodes have a type attribute (which you sometimes see in s-expressions) and a list of children.
-%p There are two basic problems when working with ruby ast: one is the a in ast, the other is ruby.
%p
- Since an abstract syntax tree only has one base class, one needs to employ the visitor
- pattern to write a compiler. This ends up being one great class with lots of unrelated
- functions, removing much of the benefit of OO.
+ The first layer in RubyX is the
+ %b Ruby Layer
+ that basically models the ast in a concrete syntax tree. This means there is one class
+ per node type.
%p
- The second, possibly bigger problem, is ruby itself: Ruby is full of programmer happiness,
- three ways to do this, five to do that. To simplify that, remove the duplication and
- make analyis easier, Vool was created.
+ The Ruby layer is then used to transform the data into the Vool layer. Eg: Implicit
+ block passing is made explicit, conditions are simplified, arguments are simplified,
+ and syntactic sugar is removed.
%h3#virtual-object-oriented-language Virtual Object Oriented Language
%p
@@ -45,8 +45,8 @@
be targeted by several real languages.
%p
The main purpose is to simplify existing oo languages down to it’s core components: mostly
- calling, assignment, continuations and exceptions. Typed classes for each language construct
- exist and make it easier to transform a statement into a lower level representations.
+ calling, assignment, continuations and exceptions. Typed classes for each language
+ construct exist and are responsible to transform a statement into Mom level below.
%p
Examples for things that exist in ruby but are broken down in Vool are
%em unless
@@ -67,12 +67,13 @@
save state.
%p
Objects are typed, and are in fact the same objects the language operates on. Just the
- functionality is expressed through instructions. Methods are in fact defined (as vool) on classes
- and then compiled to Mom/Risc/Arm and the results stored in the method object.
+ functionality is expressed through instructions. While source methods are in defined on
+ classes as Vool, when they are compiled to binary, they are made type specific. These
+ TypedMethods hold the binary and are stored in the Type.
%p
The Mom level exists to make the transition to Risc easier. It has a very abstract,
- high level instruction set, where each single instruction may resolve to many tens
- of lower level instructions. But it breaks down Vool's tree into an instruction
+ high level instruction set, where each single instruction may resolve to many (even tens of)
+ lower level instructions. But it breaks down Vool's tree into an instruction
list, which is conceptually a much easier input for the next layer.
%h3#risc Risc
@@ -83,7 +84,7 @@
The Risc machine has registers, indexed addressing, operators, branches and everything
needed to implement Mom. It does not try to abstract every possible machine feature
(like llvm), but rather “objectifies” the general risc view to provide what is needed for
- the Mom layer, the next layer up.
+ the Mom layer, the next layer up (and actually Builtin functions).
%p
The machine has it’s own (abstract) instruction set, and the mapping to arm is quite
straightforward. Since the instruction set is implemented as derived classes, additional