Sun Apr 26 09:59:19 CEST 2009
sharing data between macros
Problem: individual rpn-transformers should be able to tag words with
semantics just like the core transformer does.
One thing is to always pass the semantics macros environment around in
a hash table or so. But i wonder if it isn't a lot simpler to
re-resort to paramters, in this case syntax parameters.
Maybe I should learn to take a hint and see the use of a literal 'name
symbol as exactly the problem I'm trying to solve. The parser is
mainly about translating Forth code to simple s-expressions (in the
form of tagged atoms) so it is trivial to parse later _with_
information provided by the parsing words themselves.
(: abc 123 +) ->
((name abc) (lit 123) (apply +)) ->
(name abc ((lit 123) (apply +)))
Hmm.. i lost perspective a bit.. It looks like there's a very simple
and elegant solution hidden somewhere, but I can't find it. The clue
seems to be "fold": there is a datastructure parsed up to a certain
point, how does the next token add to this? A new slogan:
Forth parsing = fold.
To be continued..