Path: utzoo!mnetor!uunet!husc6!rutgers!bellcore!tness7!ninja!pollux!ti-csl!mips!gateley From: gateley@mips.csc.ti.com (John Gateley) Newsgroups: comp.lang.lisp Subject: Re: Common Lisp Macro Expander Wanted Message-ID: <46967@ti-csl.CSNET> Date: 18 Apr 88 04:17:54 GMT References: <49@spar.SPAR.SLB.COM> <23539@ucbvax.BERKELEY.EDU> <46438@ti-csl.CSNET> <1683@lcuxlm.UUCP> Sender: news@ti-csl.CSNET Reply-To: gateley@mips.UUCP (John Gateley) Organization: TI Computer Science Center, Dallas Lines: 22 In article <1683@lcuxlm.UUCP> ilan@lcuxlm.UUCP writes: > [...] >Do you have any ides of how to handle local macros (defined >by MACROLET)? We ended up just ignoring them - essentially because >(1) MACRO-FUNCTION only knows about global macros (because it's a >top-level function and (2) to be useful MACROEXPAND would need the >correct &ENVIRONMENT arg set up. All in all a hassle... but maybe >I'm missing something... like a screw... > >--ilan caron ..!ucbvax!vax135!lcuxlj!ilan >--Ilan Caron 201-580-5664 ..!allegra!lcuxlj!ilan ># You mentioned that it is just like the first pass of a compiler, and that is the answer to your question. You just have to pass around an argument which contains an environment mapping symbols to local macro functions. When you reach a form which is a local macro function, you just eval the macro function applied to the form (Yucch ... eval). Macrolet just extends the environment. Of course, you have to worry about scoping to do it correctly (where a local macro name might be shadowed by something else). Hope this helps John Gateley