alt
parent
2339fcfb72
commit
3f17c47d6f
@ -1,22 +1,32 @@
|
|||||||
|
#|
|
||||||
#lang s-exp syntax/module-reader
|
#lang s-exp syntax/module-reader
|
||||||
#:read read
|
#:read read
|
||||||
#:read-syntax read-syntax
|
#:read-syntax read-syntax
|
||||||
#:language `(submod ,aoc-lang expander)
|
#:language `(submod ,aoc-lang expander)
|
||||||
(require racket/runtime-path)
|
(require racket/runtime-path)
|
||||||
(define-runtime-path aoc-lang "aoc-lang.rkt")
|
(define-runtime-path aoc-lang "aoc-lang.rkt")
|
||||||
|
|#
|
||||||
|
|
||||||
(module expander br/quicklang
|
#lang br/quicklang
|
||||||
(require "helper.rkt")
|
(require "helper.rkt")
|
||||||
(provide (except-out (all-from-out br/quicklang "helper.rkt") #%module-begin)
|
(provide (except-out (all-from-out br/quicklang "helper.rkt") read-syntax #%module-begin)
|
||||||
(rename-out [#%mb #%module-begin]))
|
(rename-out [my-rs read-syntax] [my-mb #%module-begin]))
|
||||||
|
|
||||||
(define-macro (#%mb . ARGS)
|
(define (my-rs path port)
|
||||||
(with-pattern ([MODULE-PATH (syntax-source caller-stx)])
|
(define datums (for/list ([datum (in-port (curry read-syntax path) port)])
|
||||||
|
datum))
|
||||||
|
(strip-context (with-pattern ([THIS-FILE (syntax-source #'here)]
|
||||||
|
[DATUMS datums])
|
||||||
|
(syntax/loc (car datums) (module puzzle-lang THIS-FILE
|
||||||
|
. DATUMS)))))
|
||||||
|
|
||||||
|
(define-macro (my-mb . ARGS)
|
||||||
|
(with-pattern ([MOD-PATH (syntax-source caller-stx)])
|
||||||
#'(#%module-begin
|
#'(#%module-begin
|
||||||
(provide read-syntax)
|
(provide read-syntax)
|
||||||
(define (read-syntax path port)
|
(define (read-syntax path port)
|
||||||
(strip-context #`(module mod MODULE-PATH
|
(strip-context #`(module mod MOD-PATH
|
||||||
#,@(for/list ([line (in-lines port)])
|
#,@(for/list ([line (in-lines port)])
|
||||||
(for/list ([datums (in-port read (open-input-string line))])
|
(for/list ([datums (in-port read (open-input-string line))])
|
||||||
datums)))))
|
datums)))))
|
||||||
. ARGS))))
|
. ARGS)))
|
||||||
|
Reference in New Issue