macro returning more than one form

Pascal J. Bourguignon pjb at informatimago.com
Wed Mar 19 08:01:30 UTC 2014


Kenneth Tilton <ken at tiltontec.com> writes:

> On Tue, Mar 18, 2014 at 4:50 PM, Alessio Stalla <
> alessiostalla at gmail.com> wrote:
>
>     On Tue, Mar 18, 2014 at 8:54 PM, Paul Tarvydas <
>     paultarvydas at gmail.com> wrote:
>    
>         @All, thanks for the interesting discussion.  Certainly gives
>         me something to chew on.
>        
>         Re-reading the responses, I see that, while I did sort-of say
>         it, I didn't emphasize the point of this:
>        
>         I have a PEG-syntax parser written in esrap.
>        
>         I am binding at least two such parsers as reader-macros (not
>         the normal kind of macro).
>    
>    
>     I always thought that reader macros should be called a different
>     name, because they are not macros. Yes, they produce code; but
>     that's the only point they have in common with macros.
>
>
> Given that that is all that macros do, methinks that a rather
> comprehensive
> commonality.
>
> Even a keyboard macro has no job other than to take a key chord and
> produce key strokes,

Indeed, MACRO comes from greek meaning BIG, and refers to the fact that
a single item is used to represent a (possibly) BIG group of items.


A macro operator is a single operator that gets expanded into a big form
(check it out, most lisp macros expand to big forms!).

A macro character, is a single character that gets read into a big sexp.

A keyboard macro, is a single key that gets read as a big sequence of
keys.

A compiler macro, is a single function call that gets substituted by a
big, inlined and optimized, function call.



It's not the code generation that's the common part in all those macros,
it's the small to big expansion that usually occurs.


-- 
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ?  C'est le moment d'acheter !"



More information about the pro mailing list