Tue May 27 14:21:56 CEST 2008
To further distill the actual idea. There are 3 levels of
concatenative code, with each its own interpreter. The real question
is: can't they be unified into one?
These are Scat words that create target (assembly) code. They are
the simplest kind, being built directly on top of Scheme (module)
name spaces and an RPN parser. This parser reads from an input
stream, and accumulates an output Scheme syntax.
IN = stream of identifiers
OUT = accumulation of nested Scheme expression
Obtained as instantiated Macros. In macro/target-compile.ss
IN = stream of macros
OUT = accumulation of target code words
This associates names to Macro or Target code.
IN = stream of Forth syntax
OUT = list of (name . value) pairs.
Are they all really necessary? Macros are the core programming
construct and serve to describe programs. Target words determine the
instantiation level of code. Forth preprocessor allows naming of
macros and target words.
The target words layer is a consequence of manual code
instantiation. This is a feature: i want to have this level of
control. In principle this could be eliminated when the language is
made a bit more high-level (i.e. elimination of return stack access).
The preprocessor layer is necessary because of limited reflection: if
macros cannot create named code, constructs that abstract this cannot
be macros, so need to be preprocessors.
Wether all 3 layers can be implemented in more of the same way is an
interesting but not so urgent question. Wether they have to remain in
existence is easy to answer: yes. They are a consequence of two
important design choices:
* explicit instantiation (macro vs forth)
* non-reflectivity to simplify code processing and namespace handling