1#lang racket/base 2(require "../common/set.rkt" 3 "../syntax/syntax.rkt" 4 "../syntax/scope.rkt" 5 "../syntax/binding.rkt" 6 "../common/module-path.rkt") 7 8(provide runtime-stx 9 runtime-module-name 10 11 runtime-instances) 12 13;; Runtime primitives are implemented in the runtime system (and not 14;; shadowed by the expander's primitives). They're re-exported by 15;; '#%kernel, but originally exported by a '#%runtime module. The 16;; expander needs to generate references to some '#%runtime` bindings. 17 18(define runtime-scope (new-multi-scope)) 19(define runtime-stx (add-scope empty-syntax runtime-scope)) 20 21(define runtime-module-name (make-resolved-module-path '#%runtime)) 22(define runtime-mpi (module-path-index-join ''#%runtime #f)) 23 24(define (add-runtime-primitive! sym) 25 (add-binding-in-scopes! (syntax-scope-set runtime-stx 0) 26 sym 27 (make-module-binding runtime-mpi 0 sym))) 28 29;; This is only a subset that we need to have bound; 30;; the rest are added in "kernel.rkt" 31(void 32 (begin 33 (add-runtime-primitive! 'values) 34 (add-runtime-primitive! 'cons) 35 (add-runtime-primitive! 'list) 36 (add-runtime-primitive! 'make-struct-type) 37 (add-runtime-primitive! 'make-struct-type-property) 38 (add-runtime-primitive! 'gensym) 39 (add-runtime-primitive! 'string->uninterned-symbol))) 40 41;; Instances that are built into the runtime system, but 42;; not including '#%linklet 43(define runtime-instances 44 '(#%kernel 45 #%paramz 46 #%foreign 47 #%unsafe 48 #%flfxnum 49 #%extfl 50 #%network 51 #%place 52 #%futures)) 53