1 ;;; R5RS syntax expander
3 ;; Copyright (C) 2001 Free Software Foundation, Inc.
5 ;; This program is free software; you can redistribute it and/or modify
6 ;; it under the terms of the GNU General Public License as published by
7 ;; the Free Software Foundation; either version 2, or (at your option)
10 ;; This program is distributed in the hope that it will be useful,
11 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ;; GNU General Public License for more details.
15 ;; You should have received a copy of the GNU General Public License
16 ;; along with this program; see the file COPYING. If not, write to
17 ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 ;; Boston, MA 02111-1307, USA.
22 (define-module (language r5rs expand)
24 identifier? free-identifier=? bound-identifier=?
25 generate-temporaries datum->syntax-object syntax-object->datum))
28 (define $sc-put-cte #f)
29 (define $syntax-dispatch #f)
30 (define syntax-rules #f)
31 (define syntax-error #f)
32 (define identifier? #f)
33 (define free-identifier=? #f)
34 (define bound-identifier=? #f)
35 (define generate-temporaries #f)
36 (define datum->syntax-object #f)
37 (define syntax-object->datum #f)
39 (define void (lambda () (if #f #f)))
42 (lambda (f first . rest)
45 (let andmap ((first first))
46 (let ((x (car first)) (first (cdr first)))
49 (and (f x) (andmap first)))))
50 (let andmap ((first first) (rest rest))
54 (rest (map cdr rest)))
57 (and (apply f (cons x xr)) (andmap first rest)))))))))
61 (and (not (null? list1))
62 (or (proc (car list1)) (ormap proc (cdr list1))))))
64 (define putprop set-symbol-property!)
65 (define getprop symbol-property)
66 (define remprop symbol-property-remove!)
68 (define syncase-module (current-module))
70 (define (sc-eval x) (eval x syncase-module))
74 (define expand sc-expand)
77 (call-with-input-file "psyntax.ss"
79 (call-with-output-file "psyntax.scm"
81 (do ((obj (read in) (read in)))
83 (write (sc-expand obj 'c '(eval load compile)) out)))))))