commentary
This commit is contained in:
@@ -1,16 +1,24 @@
|
|||||||
The *G-Machine*
|
The *G-Machine*
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
The G-Machine (graph machine) is the current heart of rlpc, until we potentially
|
||||||
|
move onto a STG (spineless tagless graph machine) or a TIM (three-instruction
|
||||||
|
machine). rl' source code is desugared into Core; a dumbed-down subset of rl',
|
||||||
|
and then compiled to G-Machine code, which is then finally translated to the
|
||||||
|
desired target.
|
||||||
|
|
||||||
**********
|
**********
|
||||||
Motivation
|
Motivation
|
||||||
**********
|
**********
|
||||||
|
|
||||||
Our initial model, the *Template Instantiator* (TI) was a very
|
Our initial model, the *Template Instantiator* (TI) was a very straightforward
|
||||||
straightforward solution to compilation, but its core design has a major
|
solution to compilation, but its core design has a major Achilles' heel, being
|
||||||
Achilles' heel, being that Compilation is interleaved with evaluation -- The
|
that compilation is interleaved with evaluation -- The heap nodes for
|
||||||
heap nodes for supercombinators hold uninstantiated expressions, i.e. raw ASTs
|
supercombinators hold uninstantiated expressions, i.e. raw ASTs straight from
|
||||||
straight from the parser. When a supercombinator is found on the stack during
|
the parser. When a supercombinator is found on the stack during evaluation, the
|
||||||
evaluation, the template expression is instantiated (compiled) on the spot.
|
template expression is instantiated (compiled) on the spot. This makes
|
||||||
|
translation to an assembly difficult, undermining the point of an intermediate
|
||||||
|
language.
|
||||||
|
|
||||||
.. math::
|
.. math::
|
||||||
\transrule
|
\transrule
|
||||||
@@ -31,7 +39,7 @@ evaluation, the template expression is instantiated (compiled) on the spot.
|
|||||||
\text{where } h' = \mathtt{instantiateU} \; e \; a_n \; h \; g
|
\text{where } h' = \mathtt{instantiateU} \; e \; a_n \; h \; g
|
||||||
}
|
}
|
||||||
|
|
||||||
The process of instantiating a supercombinator goes something like this
|
The process of instantiating a supercombinator goes something like this:
|
||||||
|
|
||||||
1. Augment the environment with bindings to the arguments.
|
1. Augment the environment with bindings to the arguments.
|
||||||
|
|
||||||
@@ -52,13 +60,17 @@ The process of instantiating a supercombinator goes something like this
|
|||||||
Instantiating the supercombinator's body in this way is the root of our
|
Instantiating the supercombinator's body in this way is the root of our
|
||||||
Achilles' heel. Traversing a tree structure is a very non-linear task unfit for
|
Achilles' heel. Traversing a tree structure is a very non-linear task unfit for
|
||||||
an assembly target. The goal of our new G-Machine is to compile a *linear
|
an assembly target. The goal of our new G-Machine is to compile a *linear
|
||||||
sequence of instructions* which instantiate the expression at execution.
|
sequence of instructions* which, **when executed**, build up a graph
|
||||||
|
representing the code.
|
||||||
|
|
||||||
**************************
|
**************************
|
||||||
Trees and Vines, in Theory
|
Trees and Vines, in Theory
|
||||||
**************************
|
**************************
|
||||||
|
|
||||||
WIP.
|
Rather than instantiating an expression at runtime -- traversing the AST and
|
||||||
|
building a graph -- we want to compile all expressions at compile-time,
|
||||||
|
generating a linear sequence of instructions which may be executed to build the
|
||||||
|
graph.
|
||||||
|
|
||||||
**************************
|
**************************
|
||||||
Evaluation: Slurping Vines
|
Evaluation: Slurping Vines
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
The *Template Instantiator*
|
|
||||||
====================================
|
|
||||||
|
|
||||||
WIP. This will hopefully be expanded into a thorough walkthrough of the state
|
|
||||||
machine.
|
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ author = 'madeleine sydney slaga'
|
|||||||
# -- General configuration ---------------------------------------------------
|
# -- General configuration ---------------------------------------------------
|
||||||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
|
||||||
|
|
||||||
extensions = ['sphinx.ext.imgmath']
|
extensions = ['sphinx.ext.imgmath', 'sphinx.ext.graphviz']
|
||||||
|
|
||||||
# templates_path = ['_templates']
|
# templates_path = ['_templates']
|
||||||
exclude_patterns = []
|
exclude_patterns = []
|
||||||
|
|||||||
Reference in New Issue
Block a user