home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / compiler / machines / spectrum / compiler.sf < prev    next >
Encoding:
Text File  |  1999-01-02  |  3.8 KB  |  95 lines

  1. #| -*-Scheme-*-
  2.  
  3. $Id: compiler.sf,v 1.18 1999/01/02 06:06:43 cph Exp $
  4.  
  5. Copyright (c) 1988-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. |#
  21.  
  22. ;;;; Script to incrementally syntax the compiler
  23.  
  24. (load-option 'CREF)
  25.  
  26. ;; Guarantee that the compiler's package structure exists.
  27. (if (not (name->package '(COMPILER)))
  28.     (begin
  29.       ;; If there is no existing package constructor, generate one.
  30.       (if (not (file-exists? "compiler.bco"))
  31.       (begin
  32.         ((access cref/generate-trivial-constructor
  33.              (->environment '(CROSS-REFERENCE)))
  34.          "compiler")
  35.         (sf "compiler.con")))
  36.       (load "compiler.bco")))
  37.  
  38. ;; Guarantee that the necessary syntactic transforms and optimizers
  39. ;; are loaded.
  40. (if (lexical-unreferenceable? (->environment '(COMPILER)) 'SYNTAX-FILES!)
  41.     (let ((sf-and-load
  42.        (lambda (files package)
  43.          (sf-conditionally files)
  44.          (for-each (lambda (file)
  45.              (load (string-append file ".bin") package))
  46.                files))))
  47.       (load-option 'HASH-TABLE)
  48.       (write-string "\n\n---- Loading compile-time files ----")
  49.       (sf-and-load '("base/switch") '(COMPILER))
  50.       (sf-and-load '("base/macros") '(COMPILER MACROS))
  51.       ((access initialize-package! (->environment '(COMPILER MACROS))))
  52.       (sf-and-load '("machines/spectrum/decls") '(COMPILER DECLARATIONS))
  53.       (let ((environment (->environment '(COMPILER DECLARATIONS))))
  54.     (set! (access source-file-expression environment) "*.scm")
  55.     ((access initialize-package! environment)))
  56.       (sf-and-load '("base/pmlook") '(COMPILER PATTERN-MATCHER/LOOKUP))
  57.       (sf-and-load '("base/pmpars") '(COMPILER PATTERN-MATCHER/PARSER))
  58.       (fluid-let ((sf/default-syntax-table
  59.            (access compiler-syntax-table
  60.                (->environment '(COMPILER MACROS)))))
  61.     (sf-and-load '("machines/spectrum/machin") '(COMPILER)))
  62.       (fluid-let ((sf/default-declarations
  63.            '((integrate-external "insseq")
  64.              (integrate-external "machin")
  65.              (usual-definition (set expt)))))
  66.     (sf-and-load '("machines/spectrum/assmd") '(COMPILER ASSEMBLER)))
  67.       (sf-and-load '("back/syntax") '(COMPILER LAP-SYNTAXER))
  68.       (sf-and-load '("machines/spectrum/coerce" "back/asmmac"
  69.                           "machines/spectrum/insmac")
  70.            '(COMPILER LAP-SYNTAXER))
  71.       (sf-and-load '("base/scode") '(COMPILER))
  72.       (sf-and-load '("base/pmerly") '(COMPILER PATTERN-MATCHER/EARLY))
  73.       (sf-and-load '("machines/spectrum/inerly" "back/syerly")
  74.            '(COMPILER LAP-SYNTAXER))))
  75.  
  76. ;; Load the assembler instruction database.
  77. (in-package (->environment '(COMPILER LAP-SYNTAXER))
  78.   (if (and compiler:enable-expansion-declarations?
  79.        (null? early-instructions))
  80.       (fluid-let ((load-noisily? false)
  81.           (load/suppress-loading-message? false))
  82.     (write-string "\n\n---- Pre-loading instruction sets ----")
  83.     (for-each (lambda (name)
  84.             (load (string-append "machines/spectrum/" name ".scm")
  85.               '(COMPILER LAP-SYNTAXER)
  86.               early-syntax-table))
  87.           '("instr1" "instr2" "instr3")))))
  88.  
  89. ;; Resyntax any files that need it.
  90. ((access syntax-files! (->environment '(COMPILER))))
  91.  
  92. ;; Rebuild the package constructors and cref.
  93. (cref/generate-constructors "compiler")
  94. (sf "compiler.con")
  95. (sf "compiler.ldr")