init-defpackage.scm 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. ; Copyright (c) 1993-2007 by Richard Kelsey and Jonathan Rees. See file COPYING.
  2. ; This file should be loaded into the bootstrap linker before any use
  3. ; of DEFINE-STRUCTURE. Compare with env/init-defpackage.scm.
  4. (define (evaluate-transformer exp env)
  5. (if (and (pair? exp)
  6. (eq? (car exp) 'syntax-rules))
  7. (if (pair? (cdr exp))
  8. (let ((subkeywords (cadr exp))
  9. (rules (cddr exp)))
  10. (if (and (list? subkeywords)
  11. (every name? subkeywords))
  12. ;; Pair of the procedure and list of auxiliary names
  13. (cons
  14. (eval `(let-syntax ((code-quote
  15. (syntax-rules ()
  16. ((code-quote ?thing) '?thing))))
  17. ,(process-rules rules subkeywords (lambda (x) x) eq?))
  18. env)
  19. (find-free-names-in-syntax-rules subkeywords rules))
  20. exp))
  21. exp)
  22. (eval exp env)))
  23. (define-reflective-tower-maker
  24. (lambda (clauses names)
  25. (let ((env (interaction-environment)))
  26. (delay
  27. (begin (if (not (null? clauses))
  28. (warn "a FOR-SYNTAX clause appears in a package being linked by the cross-linker"
  29. `(for-syntax ,@clauses)))
  30. (cons evaluate-transformer env))))))
  31. (define-syntax code-quote
  32. (syntax-rules ()
  33. ((code-quote ?thing) '?thing)))