home *** CD-ROM | disk | FTP | other *** search
- #| -*-Scheme-*-
-
- $Id: compiler.sf,v 1.18 1999/01/02 06:06:43 cph Exp $
-
- Copyright (c) 1988-1999 Massachusetts Institute of Technology
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or (at
- your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- |#
-
- ;;;; Script to incrementally syntax the compiler
-
- (load-option 'CREF)
-
- ;; Guarantee that the compiler's package structure exists.
- (if (not (name->package '(COMPILER)))
- (begin
- ;; If there is no existing package constructor, generate one.
- (if (not (file-exists? "compiler.bco"))
- (begin
- ((access cref/generate-trivial-constructor
- (->environment '(CROSS-REFERENCE)))
- "compiler")
- (sf "compiler.con")))
- (load "compiler.bco")))
-
- ;; Guarantee that the necessary syntactic transforms and optimizers
- ;; are loaded.
- (if (lexical-unreferenceable? (->environment '(COMPILER)) 'SYNTAX-FILES!)
- (let ((sf-and-load
- (lambda (files package)
- (sf-conditionally files)
- (for-each (lambda (file)
- (load (string-append file ".bin") package))
- files))))
- (load-option 'HASH-TABLE)
- (write-string "\n\n---- Loading compile-time files ----")
- (sf-and-load '("base/switch") '(COMPILER))
- (sf-and-load '("base/macros") '(COMPILER MACROS))
- ((access initialize-package! (->environment '(COMPILER MACROS))))
- (sf-and-load '("machines/spectrum/decls") '(COMPILER DECLARATIONS))
- (let ((environment (->environment '(COMPILER DECLARATIONS))))
- (set! (access source-file-expression environment) "*.scm")
- ((access initialize-package! environment)))
- (sf-and-load '("base/pmlook") '(COMPILER PATTERN-MATCHER/LOOKUP))
- (sf-and-load '("base/pmpars") '(COMPILER PATTERN-MATCHER/PARSER))
- (fluid-let ((sf/default-syntax-table
- (access compiler-syntax-table
- (->environment '(COMPILER MACROS)))))
- (sf-and-load '("machines/spectrum/machin") '(COMPILER)))
- (fluid-let ((sf/default-declarations
- '((integrate-external "insseq")
- (integrate-external "machin")
- (usual-definition (set expt)))))
- (sf-and-load '("machines/spectrum/assmd") '(COMPILER ASSEMBLER)))
- (sf-and-load '("back/syntax") '(COMPILER LAP-SYNTAXER))
- (sf-and-load '("machines/spectrum/coerce" "back/asmmac"
- "machines/spectrum/insmac")
- '(COMPILER LAP-SYNTAXER))
- (sf-and-load '("base/scode") '(COMPILER))
- (sf-and-load '("base/pmerly") '(COMPILER PATTERN-MATCHER/EARLY))
- (sf-and-load '("machines/spectrum/inerly" "back/syerly")
- '(COMPILER LAP-SYNTAXER))))
-
- ;; Load the assembler instruction database.
- (in-package (->environment '(COMPILER LAP-SYNTAXER))
- (if (and compiler:enable-expansion-declarations?
- (null? early-instructions))
- (fluid-let ((load-noisily? false)
- (load/suppress-loading-message? false))
- (write-string "\n\n---- Pre-loading instruction sets ----")
- (for-each (lambda (name)
- (load (string-append "machines/spectrum/" name ".scm")
- '(COMPILER LAP-SYNTAXER)
- early-syntax-table))
- '("instr1" "instr2" "instr3")))))
-
- ;; Resyntax any files that need it.
- ((access syntax-files! (->environment '(COMPILER))))
-
- ;; Rebuild the package constructors and cref.
- (cref/generate-constructors "compiler")
- (sf "compiler.con")
- (sf "compiler.ldr")