home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-386-Vol-2of3.iso
/
c
/
cr-macro.zip
/
README
< prev
next >
Wrap
Text File
|
1990-02-18
|
4KB
|
94 lines
Before trying to run the code, edit the file "utils.scm" to define the
procedures SCHEME-EVAL, MAKE-TRANSFORMER-ENVIRONMENT, and ERROR
appropriately for your particular Scheme dialect.
MAKE-TRANSFORMER-ENVIRONMENT should return something that can be
passed as the second argument to SCHEME-EVAL. If your implementation
doesn't have multiple environments, then SCHEME-EVAL can simply ignore
its second argument, and the value returned by
MAKE-TRANSFORMER-ENVIRONMENT is arbitrary. If it does, note that the
environment returned by MAKE-TRANSFORMER-ENVIRONMENT need not contain
any variables other than the usual Revised^n Scheme ones. That is,
the environment doesn't have to have any of the definitions from the
macro system itself in it.
Files:
load.scm
A load script.
classes.scm
Lists all expression classes (an enumerated type).
Expression classes are represented as small integers, to permit rapid
dispatch (by indexing into a vector of procedures).
The expression classes include literal, variable, application,
and the special forms (LAMBDA, IF, DEFINE, etc.).
classify.scm
The expression expander/classifier. The heart of this is the
procedure CLASSIFY, which takes an input expression, an input
environment, and a continuation. The continuation is in turn called
with three arguments: an expression class, an expression
(possibly different from the input expression), and an environment
(possibly an extended version of the input environment).
expand.scm
A recursive expression expander. (EXPAND exp env) returns a fully
expanded and alpha-converted version of exp. (EXPAND-TOP form
env) processes a top-level form (expression or definition). (TEST
form env) calls expand-top after resetting the "color" counter to
zero.
rules.scm
Defines a (syntax-rules (<name>*) <rule>*) macro. See file
usual.scm for examples.
usual.scm
Defines the usual Revised^3 Scheme derived expression types using
the SYNTAX-RULES macro. Also defines LET*-SYNTAX. The environment
USUAL contains these definitions, so (TEST exp USUAL) can expand a
form that makes use of the derived expression types.
Differences from the previous version:
- Transformation procedures now take three arguments: expression,
rename procedure, and comparison procedure. The first argument to
the comparison procedure should be a name extracted from the input
expression, and the second argument should be a name known by the
macro (usually constant). E.g. COND would do
(compare (car clause) 'else), not (compare 'else (car clause)).
- Macros are defined with DEFINE-SYNTAX, LET-SYNTAX, and
LETREC-SYNTAX instead of DEFINE, LET, LETREC. The body of a
LET-SYNTAX or LETREC-SYNTAX is a single form, not a LAMBDA body.
A LAMBDA body may contain internal DEFINEs but not internal
DEFINE-SYNTAXes.
- REWRITE has been replaced with SYNTAX-RULES. The => noise word
has been removed. SYNTAX-RULES uses the comparison procedure
passed in to the transformation procedure, instead of EQ?, to
compare names.
- Quoted constants are now "unpainted".
- The MACRO special form and "anonymous keywords" have been flushed.
The form in a DEFINE-SYNTAX, LET-SYNTAX, etc. is now an expression
to be evaluated in the compile-time environment. Also, the feature
whereby a macro application can expand into a keyword is no
longer supports. In other words, a form is only recognized
as a special form or macro application when the operator is a
symbol.
- Most internal uses of side-effects and DELAY have been eliminated,
and variable lookup always terminates. It is hoped that the
mechanism is easier to understand than before.
- The implementation is somewhat less efficient than before in that
if the procedure expression ina combination is a symbol, the
symbol will be looked up in the environment twice.
- Generated ("painted") names are represented internally as vectors
instead of symbols. The predicate NAME? returns true of names (=
symbols + painted names), and SAME-NAME? (implemented as EQ?)
compares names.