Changeset 30994 in project


Ignore:
Timestamp:
06/09/14 08:30:37 (6 years ago)
Author:
evhan
Message:

r7rs: Expand library forms in toplevel begins

Location:
release/4/r7rs/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • release/4/r7rs/trunk/r7rs-compile-time.scm

    r30990 r30994  
    7373        (else #f)))
    7474
     75(define (expand/begin e)
     76  (match (expand e '())
     77    (('##core#begin . rest)
     78     (cons '##core#begin
     79           (map expand/begin rest)))
     80    (e* e*)))
     81
    7582(define (expand-toplevel-r7rs-library-forms exps)
    7683  (parameterize ((##sys#macro-environment (r7rs-library-macro-environment)))
    77     (map (cut expand <> '()) exps)))
     84    (map expand/begin exps)))
    7885
    7986(define (read-forms filename ci?)
     
    214221  (import-transformer 'import-for-syntax))
    215222
     223;; NOTE Not really "r7rs" -- just the core begin rewrapped in
     224;; a transformer. Used when expanding toplevel library forms.
     225(define r7rs-begin
     226  (##sys#make-structure 'transformer (macro-handler 'begin)))
     227
    216228(define (r7rs-library-macro-environment)
    217229  (filter (lambda (p)
    218230            (memv (caddr p)
    219231                  (map (cut ##sys#slot <> 1)
    220                        (list r7rs-cond-expand
     232                       (list r7rs-begin
     233                             r7rs-cond-expand
    221234                             r7rs-define-library
    222235                             r7rs-include
  • release/4/r7rs/trunk/r7rs-support.scm

    r30990 r30994  
    77  (import scheme chicken)
    88
     9  (define (macro-handler name)
     10    (cond ((assq name (##sys#macro-environment)) => caddr)
     11          (else #f)))
     12
    913  (define (wrap-er-macro-transformer name handler)
    1014    (er-macro-transformer
    11      (let ((orig (caddr (assq name (##sys#macro-environment)))))
     15     (let ((orig (macro-handler name)))
    1216       (lambda (x r c)
    1317         (let ((e (##sys#current-environment)))
Note: See TracChangeset for help on using the changeset viewer.