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 >
Text File  |  1990-02-18  |  4KB  |  94 lines

  1. Before trying to run the code, edit the file "utils.scm" to define the
  2. procedures SCHEME-EVAL, MAKE-TRANSFORMER-ENVIRONMENT, and ERROR
  3. appropriately for your particular Scheme dialect.
  4. MAKE-TRANSFORMER-ENVIRONMENT should return something that can be
  5. passed as the second argument to SCHEME-EVAL.  If your implementation
  6. doesn't have multiple environments, then SCHEME-EVAL can simply ignore
  7. its second argument, and the value returned by
  8. MAKE-TRANSFORMER-ENVIRONMENT is arbitrary.  If it does, note that the
  9. environment returned by MAKE-TRANSFORMER-ENVIRONMENT need not contain
  10. any variables other than the usual Revised^n Scheme ones.  That is,
  11. the environment doesn't have to have any of the definitions from the
  12. macro system itself in it.
  13.  
  14.  
  15. Files:
  16.  
  17.   load.scm
  18.     A load script.
  19.  
  20.   classes.scm
  21.     Lists all expression classes (an enumerated type).
  22.     Expression classes are represented as small integers, to permit rapid
  23.     dispatch (by indexing into a vector of procedures).
  24.     The expression classes include literal, variable, application,
  25.     and the special forms (LAMBDA, IF, DEFINE, etc.).
  26.  
  27.   classify.scm
  28.     The expression expander/classifier.  The heart of this is the
  29.     procedure CLASSIFY, which takes an input expression, an input
  30.     environment, and a continuation.  The continuation is in turn called
  31.     with three arguments: an expression class, an expression
  32.     (possibly different from the input expression), and an environment
  33.     (possibly an extended version of the input environment).
  34.  
  35.   expand.scm
  36.     A recursive expression expander.  (EXPAND exp env) returns a fully
  37.     expanded and alpha-converted version of exp.  (EXPAND-TOP form
  38.     env) processes a top-level form (expression or definition).  (TEST
  39.     form env) calls expand-top after resetting the "color" counter to
  40.     zero.
  41.  
  42.   rules.scm
  43.     Defines a (syntax-rules (<name>*) <rule>*) macro.  See file
  44.     usual.scm for examples.
  45.  
  46.   usual.scm
  47.     Defines the usual Revised^3 Scheme derived expression types using
  48.     the SYNTAX-RULES macro.  Also defines LET*-SYNTAX.  The environment
  49.     USUAL contains these definitions, so (TEST exp USUAL) can expand a
  50.     form that makes use of the derived expression types.
  51.  
  52. Differences from the previous version:
  53.  
  54.   - Transformation procedures now take three arguments: expression,
  55.     rename procedure, and comparison procedure.  The first argument to
  56.     the comparison procedure should be a name extracted from the input
  57.     expression, and the second argument should be a name known by the
  58.     macro (usually constant).  E.g. COND would do
  59.     (compare (car clause) 'else), not (compare 'else (car clause)).
  60.  
  61.   - Macros are defined with DEFINE-SYNTAX, LET-SYNTAX, and
  62.     LETREC-SYNTAX instead of DEFINE, LET, LETREC.  The body of a
  63.     LET-SYNTAX or LETREC-SYNTAX is a single form, not a LAMBDA body.
  64.     A LAMBDA body may contain internal DEFINEs but not internal
  65.     DEFINE-SYNTAXes. 
  66.  
  67.   - REWRITE has been replaced with SYNTAX-RULES.  The => noise word
  68.     has been removed.  SYNTAX-RULES uses the comparison procedure
  69.     passed in to the transformation procedure, instead of EQ?, to
  70.     compare names.
  71.  
  72.   - Quoted constants are now "unpainted".
  73.  
  74.   - The MACRO special form and "anonymous keywords" have been flushed.
  75.     The form in a DEFINE-SYNTAX, LET-SYNTAX, etc. is now an expression
  76.     to be evaluated in the compile-time environment.  Also, the feature
  77.     whereby a macro application can expand into a keyword is no
  78.     longer supports.  In other words, a form is only recognized
  79.     as a special form or macro application when the operator is a
  80.     symbol.
  81.  
  82.   - Most internal uses of side-effects and DELAY have been eliminated,
  83.     and variable lookup always terminates.  It is hoped that the
  84.     mechanism is easier to understand than before.
  85.  
  86.   - The implementation is somewhat less efficient than before in that
  87.     if the procedure expression ina combination is a symbol, the
  88.     symbol will be looked up in the environment twice.
  89.  
  90.   - Generated ("painted") names are represented internally as vectors
  91.     instead of symbols.  The predicate NAME? returns true of names (=
  92.     symbols + painted names), and SAME-NAME? (implemented as EQ?)
  93.     compares names.
  94.