mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
rename sc-expand to macroexpand
* module/ice-9/boot-9.scm (macroexpand): Rename from sc-expand. (%pre-modules-transformer): Adapt to name change. * module/ice-9/compile-psyntax.scm: Adapt to name change. * module/ice-9/psyntax-pp.scm: Regenerated. * module/ice-9/psyntax.scm: Rename sc-expand to macroexpand. * module/language/scheme/compile-tree-il.scm (compile-tree-il): Adapt to name change.
This commit is contained in:
parent
6ffd4131ff
commit
8a73a6d294
5 changed files with 7793 additions and 7779 deletions
|
@ -357,9 +357,9 @@ If there is no handler at all, Guile prints an error and then exits."
|
||||||
(define generate-temporaries #f)
|
(define generate-temporaries #f)
|
||||||
(define bound-identifier=? #f)
|
(define bound-identifier=? #f)
|
||||||
(define free-identifier=? #f)
|
(define free-identifier=? #f)
|
||||||
(define sc-expand #f)
|
(define macroexpand #f)
|
||||||
|
|
||||||
;; $sc-expand is an implementation detail of psyntax. It is used by
|
;; $sc-dispatch is an implementation detail of psyntax. It is used by
|
||||||
;; expanded macros, to dispatch an input against a set of patterns.
|
;; expanded macros, to dispatch an input against a set of patterns.
|
||||||
(define $sc-dispatch #f)
|
(define $sc-dispatch #f)
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ If there is no handler at all, Guile prints an error and then exits."
|
||||||
|
|
||||||
;; %pre-modules-transformer is the Scheme expander from now until the
|
;; %pre-modules-transformer is the Scheme expander from now until the
|
||||||
;; module system has booted up.
|
;; module system has booted up.
|
||||||
(define %pre-modules-transformer sc-expand)
|
(define %pre-modules-transformer macroexpand)
|
||||||
|
|
||||||
(define-syntax and
|
(define-syntax and
|
||||||
(syntax-rules ()
|
(syntax-rules ()
|
||||||
|
@ -3723,7 +3723,7 @@ module '(ice-9 q) '(make-q q-length))}."
|
||||||
;; (define (syncase exp)
|
;; (define (syncase exp)
|
||||||
;; (with-fluids ((expansion-eval-closure
|
;; (with-fluids ((expansion-eval-closure
|
||||||
;; (module-eval-closure (current-module))))
|
;; (module-eval-closure (current-module))))
|
||||||
;; (deannotate/source-properties (sc-expand (annotate exp)))))
|
;; (deannotate/source-properties (macroexpand (annotate exp)))))
|
||||||
|
|
||||||
;; FIXME:
|
;; FIXME:
|
||||||
(module-use! the-scm-module (resolve-interface '(srfi srfi-4)))
|
(module-use! the-scm-module (resolve-interface '(srfi srfi-4)))
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
(close-port in))
|
(close-port in))
|
||||||
(begin
|
(begin
|
||||||
(pretty-print (tree-il->scheme
|
(pretty-print (tree-il->scheme
|
||||||
(sc-expand x 'c '(compile load eval)))
|
(macroexpand x 'c '(compile load eval)))
|
||||||
out)
|
out)
|
||||||
(newline out)
|
(newline out)
|
||||||
(loop (read in))))))
|
(loop (read in))))))
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -45,7 +45,7 @@
|
||||||
;;; Scheme, please read the notes below carefully.
|
;;; Scheme, please read the notes below carefully.
|
||||||
|
|
||||||
|
|
||||||
;;; This file defines the syntax-case expander, sc-expand, and a set
|
;;; This file defines the syntax-case expander, macroexpand, and a set
|
||||||
;;; of associated syntactic forms and procedures. Of these, the
|
;;; of associated syntactic forms and procedures. Of these, the
|
||||||
;;; following are documented in The Scheme Programming Language,
|
;;; following are documented in The Scheme Programming Language,
|
||||||
;;; Second Edition (R. Kent Dybvig, Prentice Hall, 1996). Most are
|
;;; Second Edition (R. Kent Dybvig, Prentice Hall, 1996). Most are
|
||||||
|
@ -73,8 +73,8 @@
|
||||||
|
|
||||||
;;; The remaining exports are listed below:
|
;;; The remaining exports are listed below:
|
||||||
;;;
|
;;;
|
||||||
;;; (sc-expand datum)
|
;;; (macroexpand datum)
|
||||||
;;; if datum represents a valid expression, sc-expand returns an
|
;;; if datum represents a valid expression, macroexpand returns an
|
||||||
;;; expanded version of datum in a core language that includes no
|
;;; expanded version of datum in a core language that includes no
|
||||||
;;; syntactic abstractions. The core language includes begin,
|
;;; syntactic abstractions. The core language includes begin,
|
||||||
;;; define, if, lambda, letrec, quote, and set!.
|
;;; define, if, lambda, letrec, quote, and set!.
|
||||||
|
@ -101,9 +101,9 @@
|
||||||
;;; eval will not be invoked during the loading of psyntax.pp. After
|
;;; eval will not be invoked during the loading of psyntax.pp. After
|
||||||
;;; psyntax.pp has been loaded, the expansion of any macro definition,
|
;;; psyntax.pp has been loaded, the expansion of any macro definition,
|
||||||
;;; whether local or global, will result in a call to eval. If, however,
|
;;; whether local or global, will result in a call to eval. If, however,
|
||||||
;;; sc-expand has already been registered as the expander to be used
|
;;; macroexpand has already been registered as the expander to be used
|
||||||
;;; by eval, and eval accepts one argument, nothing special must be done
|
;;; by eval, and eval accepts one argument, nothing special must be done
|
||||||
;;; to support the "noexpand" flag, since it is handled by sc-expand.
|
;;; to support the "noexpand" flag, since it is handled by macroexpand.
|
||||||
;;;
|
;;;
|
||||||
;;; (gensym)
|
;;; (gensym)
|
||||||
;;; returns a unique symbol each time it's called
|
;;; returns a unique symbol each time it's called
|
||||||
|
@ -111,7 +111,7 @@
|
||||||
;;; When porting to a new Scheme implementation, you should define the
|
;;; When porting to a new Scheme implementation, you should define the
|
||||||
;;; procedures listed above, load the expanded version of psyntax.ss
|
;;; procedures listed above, load the expanded version of psyntax.ss
|
||||||
;;; (psyntax.pp, which should be available whereever you found
|
;;; (psyntax.pp, which should be available whereever you found
|
||||||
;;; psyntax.ss), and register sc-expand as the current expander (how
|
;;; psyntax.ss), and register macroexpand as the current expander (how
|
||||||
;;; you do this depends upon your implementation of Scheme). You may
|
;;; you do this depends upon your implementation of Scheme). You may
|
||||||
;;; change the hooks and constructors defined toward the beginning of
|
;;; change the hooks and constructors defined toward the beginning of
|
||||||
;;; the code below, but to avoid bootstrapping problems, do so only
|
;;; the code below, but to avoid bootstrapping problems, do so only
|
||||||
|
@ -2395,7 +2395,7 @@
|
||||||
(list (chi #'val r empty-wrap mod))))
|
(list (chi #'val r empty-wrap mod))))
|
||||||
(syntax-violation 'syntax-case "invalid literals list" e))))))))
|
(syntax-violation 'syntax-case "invalid literals list" e))))))))
|
||||||
|
|
||||||
;;; The portable sc-expand seeds chi-top's mode m with 'e (for
|
;;; The portable macroexpand seeds chi-top's mode m with 'e (for
|
||||||
;;; evaluating) and esew (which stands for "eval syntax expanders
|
;;; evaluating) and esew (which stands for "eval syntax expanders
|
||||||
;;; when") with '(eval). In Chez Scheme, m is set to 'c instead of e
|
;;; when") with '(eval). In Chez Scheme, m is set to 'c instead of e
|
||||||
;;; if we are compiling a file, and esew is set to
|
;;; if we are compiling a file, and esew is set to
|
||||||
|
@ -2404,7 +2404,7 @@
|
||||||
;;; syntactic definitions are evaluated immediately after they are
|
;;; syntactic definitions are evaluated immediately after they are
|
||||||
;;; expanded, and the expanded definitions are also residualized into
|
;;; expanded, and the expanded definitions are also residualized into
|
||||||
;;; the object file if we are compiling a file.
|
;;; the object file if we are compiling a file.
|
||||||
(set! sc-expand
|
(set! macroexpand
|
||||||
(lambda (x . rest)
|
(lambda (x . rest)
|
||||||
(if (and (pair? x) (equal? (car x) noexpand))
|
(if (and (pair? x) (equal? (car x) noexpand))
|
||||||
(cadr x)
|
(cadr x)
|
||||||
|
@ -2452,7 +2452,7 @@
|
||||||
(arg-check (lambda (x) (or (not x) (string? x) (symbol? x)))
|
(arg-check (lambda (x) (or (not x) (string? x) (symbol? x)))
|
||||||
who 'syntax-violation)
|
who 'syntax-violation)
|
||||||
(arg-check string? message 'syntax-violation)
|
(arg-check string? message 'syntax-violation)
|
||||||
(scm-error 'syntax-error 'sc-expand
|
(scm-error 'syntax-error 'macroexpand
|
||||||
(string-append
|
(string-append
|
||||||
(if who "~a: " "")
|
(if who "~a: " "")
|
||||||
"~a "
|
"~a "
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
;;; Guile Scheme specification
|
;;; Guile Scheme specification
|
||||||
|
|
||||||
;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
|
;; Copyright (C) 2001, 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
;;;; This library is free software; you can redistribute it and/or
|
;;;; This library is free software; you can redistribute it and/or
|
||||||
;;;; modify it under the terms of the GNU Lesser General Public
|
;;;; modify it under the terms of the GNU Lesser General Public
|
||||||
|
@ -29,6 +29,6 @@
|
||||||
(save-module-excursion
|
(save-module-excursion
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(set-current-module e)
|
(set-current-module e)
|
||||||
(let* ((x (sc-expand x 'c '(compile load eval)))
|
(let* ((x (macroexpand x 'c '(compile load eval)))
|
||||||
(cenv (current-module)))
|
(cenv (current-module)))
|
||||||
(values x cenv cenv)))))
|
(values x cenv cenv)))))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue