[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Splicing macro's & CGOL.
- To: BUG-LISPM at MIT-MC
- Subject: Re: Splicing macro's & CGOL.
- From: George J. Carrette <GJC at MIT-MC>
- Date: Fri ,10 Apr 81 18:38:00 EDT
- Cc: LISP-FORUM at MIT-MC
I have brought the Pratt parser for CGOL up on the lisp
machine. Therefore the question of how to introduce CGOL
syntax expressions comes up. I don't even want to mention
how it is done in maclisp.
Intuitively, what I want is a splicing macro. Let's say I
used sharp-sign-altmode to mean read in a sequence of cgol expressions.
However, splicing-macro's don't work at top-level, so I'll
tell you what I really need, a continuation macro.
I'll try to be exact here so that there is no confusion.
The toplevel READ nominally receives two arguments,
the STREAM to READ from, and a continuation to which to return.
If a continuation macro is read at top-level then what it
gets passed is the stream and the continuation.
(defun sharp-altcont (stream continuation)
(DO ((FORM (CGOLREAD STREAM) (CGOLREAD STREAM)))
((EQUAL FORM '(EXIT)) NIL)
(FUNCALL CONTINUATION FORM)))
To me the continuation passing makes a lot of sense for
any situation thats doing a READ-FROBULATE loop (actually MAPPING)
over a stream. Both COMPILE and LOAD could use it.
In the mean time I can make my splicing macro return a
"PROGN-QUOTE-COMPILE" when it needs to.