1 ;;; Guile Scheme specification
3 ;; Copyright (C) 2001, 2009 Free Software Foundation, Inc.
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.
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.
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
21 (define-module (language scheme spec)
22 #:use-module (system base compile)
23 #:use-module (system base language)
24 #:use-module (language scheme compile-tree-il)
25 #:use-module (language scheme decompile-tree-il)
32 (read-enable 'positions)
35 ;;; Language definition
38 (define-language scheme
39 #:title "Guile Scheme"
41 #:reader (lambda (port env)
42 ;; Use the binding of current-reader from the environment.
43 ;; FIXME: Handle `read-options' as well?
44 ((or (and=> (and=> (module-variable env 'current-reader)
50 #:compilers `((tree-il . ,compile-tree-il))
51 #:decompilers `((tree-il . ,decompile-tree-il))
52 #:evaluator (lambda (x module) (primitive-eval x))
54 #:make-default-environment
56 ;; Ideally we'd duplicate the whole module hierarchy so that `set!',
57 ;; `fluid-set!', etc. don't have any effect in the current environment.
58 (let ((m (make-fresh-user-module)))
59 ;; Provide a separate `current-reader' fluid so that
60 ;; compile-time changes to `current-reader' are
61 ;; limited to the current compilation unit.
62 (module-define! m 'current-reader (make-fluid))