Sat Mar 15 10:01:51 EDT 2008
in a code quotation, it should be possible to override the
language. if the first identifier in a program is a syntactic form,
then use it to transform the expression, otherwise use default.
not so straightforward. actually, it is: using
(define (transformer? id-stx)
id-stx (lambda () #f)))
maybe the possibility to do this recursively would be nice? that way
all kinds of syntax extensions can be implemented, and forth could be
this can probably be handled in dispatch?
almost. it's a partial fold, while currently represent is a full
(left) fold. fold up to encountering a transformer, then pass the
remainder of the expression to the transformer (who might call
first: cleanup some things. move the symbol mapping to a single
second: having syntax in the middle of an expansion isn't really
sound, right? what would (a _b c) do, with _b syntax?
(represent (a _b c)) ->
(lambda s (represent/step (a _b c) s)) ->
(represent/step (a _b c) s) ->
(dispatch a s)))
well.. it does make sense. if a is not syntax, the result is an expression
ok.. i got something working: string things together with
'rpn-compile' until a transformer is encountered, upon which the
rest of the code is handed off.
however: still can't use '(lambda <f> <b>)' because the there's
already a lambda wrapped.
i wonder however: why not allow true parsing words? the loop over a
code body could be made more explicit: give words access to the syntax
objects. the traditional 'immediate' words could be used. no.. they
need to be macros: need to be available at expand time, and function
bindings aren't. so i'm on the right track.