initial.scm 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. ; Part of Scheme 48 1.9. See file COPYING for notices and license.
  2. ; Authors: Richard Kelsey, Jonathan Rees, Marcus Crestani
  3. ; Link script.
  4. (define (link-initial-system)
  5. (let ((structures-to-open ;Structures to open for the initial
  6. (struct-list scheme ;system's read-eval-print loop.
  7. platform
  8. environments
  9. module-system
  10. ensures-loaded
  11. packages
  12. packages-internal))) ; package-for-syntax
  13. (link-reified-system (append (desirable-structures)
  14. structures-to-open)
  15. '(build initial)
  16. ;; The expression that evaluates to the
  17. ;; procedure that maps the reified-structure alist
  18. ;; to the startup procedure:
  19. `(start ',(map car structures-to-open))
  20. ;; Structures to open for evaluating that
  21. ;; expression and the expression that
  22. ;; evaluates to the reified-structure alist:
  23. initial-system
  24. for-reification
  25. ;; scheme-level-1
  26. )))
  27. (define (desirable-structures)
  28. (let ((env (interaction-environment))
  29. (l '()))
  30. (for-each (lambda (int)
  31. (for-each-declaration
  32. (lambda (name package-name type)
  33. (if (not (assq name l))
  34. (let ((s (eval name env)))
  35. (if (structure? s)
  36. (set! l (cons (cons name s) l))))))
  37. int))
  38. (list low-structures-interface
  39. run-time-structures-interface
  40. features-structures-interface
  41. run-time-internals-structures-interface
  42. compiler-structures-interface
  43. initial-structures-interface))
  44. (reverse l)))
  45. ; Your choice of evaluators:
  46. (define scheme (make-scheme environments evaluation))
  47. ; (define scheme (make-scheme mini-environments mini-eval))
  48. ; (define scheme (make-scheme environments run))
  49. ; etc.
  50. ; Your choice of command processors.
  51. (define initial-system
  52. (make-initial-system scheme (make-mini-command scheme)))