* macro expander prototype code
@ 2002-09-01 11:11 Lynn Winebarger
0 siblings, 0 replies; only message in thread
From: Lynn Winebarger @ 2002-09-01 11:11 UTC (permalink / raw)
I've written yet another meta-circular partial scheme interpreter.
The main reason for doing this (for me, anyway) is to see
how the macro expansion should work. It could also
serve as a sort of documentation for eval, as it's structured
_very_ similarly to it (except CPSing). I don't know how
many people who might want to work on guile have had
the basic PL course where they wrote a Scheme interpreter,
but if someone hasn't, something like this might help.
I've got the let-syntax/letrec-syntax/define-syntax (both
internal and external) working correctly, but right now the
only transformer available is what I call "unclean-rules"
(the syntax-rules pattern language (actually a little more
powerful) but with absolutely no hygeine).
For example, this works:
(let ()
(define even?
(lambda (x)
(or (= x 0) (odd? (- x 1)))))
(define-syntax odd?
(unclean-rules ()
((_ y) (not (even? y)))))
(even? 10)))
=> #t
which is taken directly out of TSPL2, modulo syntax-rules.
Unfortunately, I doubt this code will run on guile at the
moment. It uses syntax-case heavily in the form
of a home-brew fixed/variant record system and
a pattern-case/pattern-let. I'm using Petite Chez
as I know it has a working syntax-case system. ;-)
Still, I thought someone else might be interested
in seeing it. Basically I need to add hygeine and
CPS the interpreter/parser. Most of the machinery
is there for that too, as I've split lexical environments
from value environments, and classified the bindings
(as macros, values, or top-level which can hold both
simultaneously, as well as a pattern type for syntax)
Let me know if you're interested.
Lynn
_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-09-01 11:11 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-01 11:11 macro expander prototype code Lynn Winebarger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).