Recursive expansion of pmacros (was: Re: Typo: .substr in pmacros.texi is .substring in pmacros.scm)

Hans-Peter Nilsson hans-peter.nilsson@axis.com
Tue Mar 19 13:20:00 GMT 2002


> From: Doug Evans <dje@transmeta.com>
> Date: Tue, 19 Mar 2002 12:24:36 -0800 (PST)
> Cc: cgen@sources.redhat.com

> Hans-Peter Nilsson writes:
>  > As I wrote, I had already startet to depend upon it in a port in
>  > progress.  I greatly simplified things (or made it hard in the
>  > absence, I should say).
> 
> Note that there are otherways to do this, besides the implicit re-lookup.

I'm totally blank (what "this"?)  I generally want to map a
pmacro on a list defined as a pmacro, generating calls to other
pmacros.  How can I do that without re-lookup?

(define-pmacro x (a b c))
(define-pmacro (do-a y) (+ y 1))
(define-pmacro (do-b y) (- y 1))
(define-pmacro '(do-c y) (* y 2))
(pmacro-expand '(.map (.pmacro (z) ((.sym code- z) ((.sym do- z) w))) x))
=> ((code-a (+ w 1)) (code-b (- w 1)) (code-c (* w 2)))

Hmm, maybe that didn't come out clear.  Tell me if you feel you
need something better.

brgds, H-P



More information about the Cgen mailing list