gbye
parent
0571f4ebdb
commit
e865961c8c
@ -1,26 +0,0 @@
|
||||
#lang racket
|
||||
(provide (except-out (all-from-out racket) #%module-begin)
|
||||
(rename-out [loader-module-begin #%module-begin]))
|
||||
|
||||
#|
|
||||
|
||||
br/load makes it possible to invoke a quick #lang by its pathname (without installing it as a collection)
|
||||
|
||||
#lang br/load "path.rkt"
|
||||
|
||||
Should simply delegate the reader & semantics.
|
||||
|
||||
|#
|
||||
|
||||
(define-syntax-rule (loader-module-begin loadpath expr ...)
|
||||
(#%module-begin
|
||||
(module loader-module loadpath
|
||||
expr ...)
|
||||
(require 'loader-module)
|
||||
|
||||
(module reader racket/base
|
||||
(require '(submod loadpath reader))
|
||||
(provide (all-from-out '(submod loadpath reader))))))
|
||||
|
||||
(module reader syntax/module-reader
|
||||
br/load)
|
@ -1,37 +0,0 @@
|
||||
#lang racket/base
|
||||
(require (for-syntax racket/base) racket/stxparam racket/splicing)
|
||||
(provide splicing-syntax-parameterize
|
||||
define-syntax-parameters
|
||||
define-language-variables
|
||||
define-language-variable
|
||||
inject-language-variables
|
||||
(rename-out [br:define-syntax-parameter define-syntax-parameter]))
|
||||
|
||||
(define-syntax (br:define-syntax-parameter stx)
|
||||
(syntax-case stx ()
|
||||
[(_ ID STX) #'(define-syntax-parameter ID STX)]
|
||||
[(_ [ID VAL]) #'(define-syntax-parameter ID (λ (stx) #'VAL))]
|
||||
[(_ ID) #'(define-syntax-parameter ID
|
||||
(λ (stx) (raise-syntax-error (syntax-e stx) "parameter not set")))]))
|
||||
|
||||
(define-syntax-rule (define-syntax-parameters ID ...)
|
||||
(begin (br:define-syntax-parameter ID) ...))
|
||||
|
||||
(define-syntax-rule (define-language-variable ID VAL)
|
||||
(br:define-syntax-parameter [ID VAL]))
|
||||
|
||||
(define-syntax-rule (define-language-variables [ID VAL] ...)
|
||||
(begin (define-language-variable ID VAL) ...))
|
||||
|
||||
(define-syntax (inject-language-variables stx)
|
||||
(syntax-case stx ()
|
||||
[(_ (VAR-PARAM ...) LANG-CODE ...)
|
||||
(with-syntax ([(HOLDS-ORIG-PARAM-VALUE ...) (generate-temporaries #'(VAR-PARAM ...))]
|
||||
[(INTERNAL-NAME ...) (generate-temporaries #'(VAR-PARAM ...))])
|
||||
;; need to use splicing expressions in a module-begin to compose with requires etc. that might be in lang code
|
||||
#'(splicing-let ([HOLDS-ORIG-PARAM-VALUE VAR-PARAM] ...)
|
||||
(splicing-syntax-parameterize
|
||||
([VAR-PARAM (make-rename-transformer #'INTERNAL-NAME)] ...)
|
||||
(define INTERNAL-NAME HOLDS-ORIG-PARAM-VALUE) ...
|
||||
(provide (rename-out [INTERNAL-NAME VAR-PARAM] ...))
|
||||
LANG-CODE ...)))]))
|
Loading…
Reference in New Issue