Prelisp currently implements macro support. Rather than define the macro language, macro evaluation is offloaded to the Guile Scheme implementation. This means that macro bodies are Scheme procedures!
Not only does this make it trivial to write macros that return s-expressions, but also gives the programmer access to a powerful set of features.
Consider, for example, the first test added as part of this PR: src/tests/prelisp/macro.sexp. A macro called time is defined and used in a C-Lisp program.
What the macro body does is to accept a string of the form "MMDDYYYY", convert it to seconds since epoch and return it; the resulting integer overwrites the macro invocation to produce the following C-Lisp program (indented by hand, otherwise identical to the original output):
Prelisp currently implements macro support. Rather than define the macro language, macro evaluation is offloaded to the Guile Scheme implementation. This means that macro bodies are Scheme procedures!
Not only does this make it trivial to write macros that return s-expressions, but also gives the programmer access to a powerful set of features.
Consider, for example, the first test added as part of this PR: src/tests/prelisp/macro.sexp. A macro called
time
is defined and used in a C-Lisp program.What the macro body does is to accept a string of the form "MMDDYYYY", convert it to seconds since epoch and return it; the resulting integer overwrites the macro invocation to produce the following C-Lisp program (indented by hand, otherwise identical to the original output):