Change Guile license to LGPLv3+
[bpt/guile.git] / module / language / r5rs / spec.scm
CommitLineData
ea9c5dab 1;;; Guile R5RS
296ad2b4
KN
2
3;; Copyright (C) 2001 Free Software Foundation, Inc.
4
53befeb7
NJ
5;;;; This library is free software; you can redistribute it and/or
6;;;; modify it under the terms of the GNU Lesser General Public
7;;;; License as published by the Free Software Foundation; either
8;;;; version 3 of the License, or (at your option) any later version.
9;;;;
10;;;; This library 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 GNU
13;;;; Lesser General Public License for more details.
14;;;;
15;;;; You should have received a copy of the GNU Lesser General Public
16;;;; License along with this library; if not, write to the Free Software
17;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
296ad2b4 18
ea9c5dab
KN
19;;; Code:
20
296ad2b4 21(define-module (language r5rs spec)
1a1a10d3
AW
22 #:use-module (system base language)
23 #:use-module (language r5rs expand)
24 #:use-module (language r5rs translate)
25 #:export (r5rs))
296ad2b4 26
ea9c5dab
KN
27\f
28;;;
29;;; Translator
30;;;
31
32(define (translate x) (if (pair? x) (translate-pair x) x))
33
34(define (translate-pair x)
a80be762
KN
35 (let ((head (car x)) (rest (cdr x)))
36 (case head
37 ((quote) (cons '@quote rest))
ea9c5dab 38 ((define set! if and or begin)
a80be762 39 (cons (symbol-append '@ head) (map translate rest)))
ea9c5dab 40 ((let let* letrec)
a80be762
KN
41 (cons* (symbol-append '@ head)
42 (map (lambda (b) (cons (car b) (map translate (cdr b))))
43 (car rest))
44 (map translate (cdr rest))))
ea9c5dab 45 ((lambda)
a80be762 46 (cons* '@lambda (car rest) (map translate (cdr rest))))
ea9c5dab 47 (else
a80be762 48 (cons (translate head) (map translate rest))))))
ea9c5dab
KN
49
50\f
51;;;
52;;; Language definition
53;;;
54
296ad2b4 55(define-language r5rs
1a1a10d3
AW
56 #:title "Standard Scheme (R5RS + syntax-case)"
57 #:version "0.3"
58 #:reader read
59 #:expander expand
60 #:translator translate
61 #:printer write
62;; #:environment (global-ref 'Language::R5RS::core)
296ad2b4 63 )