Tue Aug 5 09:52:59 CEST 2008
* math primitives: coded manualy (DONE)
* macro mapping: coded manually
* parser map:
- num -> num hilo
- word -> _word
This should be written as a pure parser.
I think I'm running into a composition problem here: I can't find a
straightforward way to plug in the 'derived: word to 'forth-begin.
Let's go to the definition of 'forth-compile and work from there.
(define-syntax (forth-compile stx)
(syntax-case stx ()
This inserts lexed syntax into forth-begin. Maybe 'forth-begin needs a
namespace argument? Let's see where '(macro) is hardcoded. That's in
'forth-begin-tx, where the records returned by the parser are assigned
to a namespace.
I thought there's one more hardcoding reference, which is in rpn-tx.ss
where '(macro) namespace is used to check if a particular identifier
is a parser, but this is actually parameterized by
What about using the latter in 'forth-begin-tx too?
Next: should the '(target) namespace be remapped too?
Ok, parameterized a bit, but that leads to other spaghetti being
exposed. Atm, the thorn is the fact that instantiate.ss references the
'(macro) namespace. Shouldn't this be generic? I just moved these
references out of 'forth-begin, but the only thing that macro does is
to bind instantiate.ss to the forth parser-tx.ss
Trying to fix something else first: parser-tx.ss doesn't need to be
aware of the wrapping words, it should just provide an abstract data
structure with 'forth 'variable and 'macro tags. OK. The code classes
are interpreted in 'forth-begin-tx and not passed to 'forth->records.
Maybe the next step is to also generate the toplevel scheme forms as
part of the records structure to avoid awkward passing of out-of-band
data through muting parameters? Done.
Alright, it's a bit cleaner now. Maybe this is enough to build a
front-end that takes macros from a different namespace? Still there's
the problem of how to link target functions back to the original
target namespace. Maybe this is more of a nested namespace problem
actually? Using '(macro derived) and '(target derived) does make
symbols accessible as derived/+ dervived/- etc... in the core space.
This does requires a decision: to make name space mapping standard.