[stuff tom@zwizwa.be**20090517081428 Ignore-this: 1b5cbd82e5b470d2d74efb41cfdad0c9 ] move ./broken-scribblings ./doc/old-scribblings move ./staapl/scribblings/staapl-introduction.scrbl ./staapl/scribblings/staapl.scrbl hunk ./doc/staapl-ramblings.txt 47244 +Entry: removed front page stuff again.. +Date: Sun May 17 10:04:27 CEST 2009 + +I keep on doing this.. Why? Anyways, the new introduction says almost +the same as this, but with examples. + + +
+ Metaprogramming is about manipulating programs as data. A key + element here is the representation of programs. Being a compiler, + Staapl has two languages to deal with: a high-level input language + and a low-level output language. Both languages are + concatenative. +
[op].
+
+ [op]->[op].
+ A meaning can be attached to high-level concatenative source + code using the following compilation algorithm: +
[op]->[op]
+ transformer.
+ [op]->[op] transformers using
+ function composition, in the order their tokens appear in the
+ input program source.
+ [] to
+ obtain the final output program.
+ [op]->[op]
+ function appends a small machine code fragment to the code
+ accumulator, essentially behaving as
+ an assembler
+ macro. However, the function is free to modify the accumulated code in
+ its entirety, performing any optimization it sees fit.
+
+Using this representation the task of building code generators can +be split in these parts +
(macro: 123
+ +) creates a composite code transformer, built from the
+ code transformers 123 and +.
+ The macro: form behaves as quasiquote, facilitating
+ template programming. I.e. the previous transformer is
+ equivalent to (let ((x 123)) (macro: ',x +)).
+
+ [op] processors, and possibly defining a machine
+ instruction set op that has the double function of
+ representing target semantics and serving as a representation of
+ compile time data.
+ By interpreting the code list [op] as a stack and
+ adding an op instruction (QW value) that
+ represents loading of a literal value on the
+ parameter
+ stack at run time, it is possible to implement Forth with eager
+ partial evaluation.
+
I.e. the function associated to the token word +
+ would normally only compile machine code that pops 2 numbers from
+ the run-time stack, adds them and pushes the result to the stack.
+ Instead it could be made to inspect the code it is passed for any
+ instructions that load literal values on the runtime stack, remove
+ those, perform the addition at compile time, and generate code for a
+ constant instead.
+
+
Note that the basic structure of [op] lists
+ and [op]->[op] transformers is more general than stack
+ languages. In fact, it could be used to implement partially
+ evaluating macro languages for any kind of state machine.
+
+
+Entry: previous introduction
+Date: Sun May 17 10:09:46 CEST 2009
+
+It's sort of ok, but I think the new one is better because it uses
+examples. Let's keep it around.
+
+
hunk ./staapl/scribblings/Makefile 1
-DOC = staapl-introduction.pdf staapl-introduction.html
+DOC = staapl.pdf staapl.html
hunk ./www/index.html 37
- microcontroller architecture, and live interaction tools and a
- Forth-style console for debugging and testing.
-
-
-
-
- Metaprogramming is about manipulating programs as data. A key - element here is the representation of programs. Being a compiler, - Staapl has two languages to deal with: a high-level input language - and a low-level output language. Both languages are - concatenative. -
[op].
-
- [op]->[op].
- A meaning can be attached to high-level concatenative source - code using the following compilation algorithm: -
[op]->[op]
- transformer.
- [op]->[op] transformers using
- function composition, in the order their tokens appear in the
- input program source.
- [] to
- obtain the final output program.
- [op]->[op]
- function appends a small machine code fragment to the code
- accumulator, essentially behaving as
- an assembler
- macro. However, the function is free to modify the accumulated code in
- its entirety, performing any optimization it sees fit.
-
-Using this representation the task of building code generators can -be split in these parts -
(macro: 123
- +) creates a composite code transformer, built from the
- code transformers 123 and +.
- The macro: form behaves as quasiquote, facilitating
- template programming. I.e. the previous transformer is
- equivalent to (let ((x 123)) (macro: ',x +)).
-
- [op] processors, and possibly defining a machine
- instruction set op that has the double function of
- representing target semantics and serving as a representation of
- compile time data.
- By interpreting the code list [op] as a stack and
- adding an op instruction (QW value) that
- represents loading of a literal value on the
- parameter
- stack at run time, it is possible to implement Forth with eager
- partial evaluation.
-
I.e. the function associated to the token word +
- would normally only compile machine code that pops 2 numbers from
- the run-time stack, adds them and pushes the result to the stack.
- Instead it could be made to inspect the code it is passed for any
- instructions that load literal values on the runtime stack, remove
- those, perform the addition at compile time, and generate code for a
- constant instead.
-
-
Note that the basic structure of [op] lists
- and [op]->[op] transformers is more general than stack
- languages. In fact, it could be used to implement partially
- evaluating macro languages for any kind of state machine.
-
+ microcontroller architecture, and a Forth-style interactive console
+ for debugging and testing.