Mon Jun 8 14:27:33 CEST 2009
A balance between lowlevel and highlevel Scheme macros
Most of Staapl is now in macro form. Most of the macros themselves
are high-level rewrite macros that only use syntax-rules. Some are
low-level syntax-case macros that use Scheme code to operate on syntax
objects directly, usually because they need to do some form of global
The breaking point between the two forms is usually taken to be the
point where you want to do write a macro that uses some abstract code
to process its syntax input before it generates its syntax output.
However, I've found it to ly a little bit further than that. There
are cases where the absence of a composition mechanism (macro
subroutine calls) doesn't offset the convenience of a pattern
language, mostly because of the convenience of ellipsis "...".
Sometimes it is possible to construct CPS-style macros that are
parameterized in the form they will expand to. As long as the actual
processing that is happening is linear (a simple pipe, i.e. a lexer
macro passing data to a parser macro) this works fairly well.