Last active
August 29, 2015 14:01
-
-
Save samth/e7b55fcef66da9b8416a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(module evaluator racket | |
;; Allow evaluation at phase1 | |
(require (for-syntax racket/base syntax/parse)) | |
(provide phase1-phase0-eval phase1-phase0-run) | |
(define-namespace-anchor anchor) | |
(define namespace (namespace-anchor->empty-namespace anchor)) | |
(define-syntax phase1-phase0-run | |
(syntax-parser | |
[(_ form:expr ...) | |
#'(let-syntax ([go (lambda (stx) form ...)]) (go))])) | |
(define-syntax phase1-phase0-eval | |
(syntax-parser | |
[(_ form:expr ...) | |
#'(eval-syntax (quote-syntax (phase1-phase0-run form ...)) namespace)]))) | |
(module f racket | |
(require (submod ".." evaluator)) | |
(provide f) | |
(define (f) (phase1-phase0-eval (display "hello") #'#f))) | |
(define ns (make-base-namespace)) | |
(current-namespace ns) | |
(require syntax/location) | |
(define name (quote-module-path f)) | |
;(dynamic-require name 0) | |
((dynamic-require name 'f)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment