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 / C / compiler.sf < prev    next >
Text File  |  1999-01-02  |  3KB  |  75 lines

  1. #| -*-Scheme-*-
  2.  
  3. $Id: compiler.sf,v 1.6 1999/01/02 06:06:43 cph Exp $
  4.  
  5. Copyright (c) 1992-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/C/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.       (sf-and-load '("rtlbase/valclass") '(COMPILER))
  59.       (fluid-let ((sf/default-syntax-table
  60.            (access compiler-syntax-table
  61.                (->environment '(COMPILER MACROS)))))
  62.     (sf-and-load '("machines/C/machin") '(COMPILER)))
  63.       (set! (access endianness (->environment '(COMPILER))) 'BIG)
  64.       (sf-and-load '("back/syntax")
  65.            '(COMPILER LAP-SYNTAXER))
  66.       (sf-and-load '("base/scode") '(COMPILER))
  67.       (sf-and-load '("base/pmerly") '(COMPILER PATTERN-MATCHER/EARLY))))
  68.  
  69. ;; Resyntax any files that need it.
  70. ((access syntax-files! (->environment '(COMPILER))))
  71.  
  72. ;; Rebuild the package constructors and cref.
  73. (cref/generate-constructors "compiler")
  74. (sf "compiler.con")
  75. (sf "compiler.ldr")