-
Notifications
You must be signed in to change notification settings - Fork 3
/
aoe.rkt
37 lines (33 loc) · 1.13 KB
/
aoe.rkt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#lang racket
(provide (rename-out [mb #%module-begin]) #%app #%datum #%top #%top-interaction)
(require frosthaven-manager/aoe-images
syntax/parse/define)
(define-syntax-parser mb
[(_ spec:expr)
(syntax/loc this-syntax
(#%module-begin
(provide aoe)
(define (aoe)
(spec->shape 'spec))
(module+ main
(require racket/gui pict)
(show-pict (aoe)))))])
(module reader syntax/module-reader
frosthaven-manager/aoe
#:module-wrapper
(λ (make-module stx?)
(cond
[stx? (syntax-parse (make-module)
[(module name module-path
(#%module-begin x:aoe-spec ...))
(define xs (syntax->list #'(x ...)))
(define spec (datum->syntax #'(x ...) (syntaxes->spec xs) #'(x ...)))
(strip-context
#`(module name module-path
(#%module-begin #,spec)))])]
[else (make-module)]))
(require frosthaven-manager/aoe-images
syntax/parse
syntax/strip-context)
(define-syntax-class aoe-spec
[pattern {~or {~datum s} {~datum x} {~datum o} {~datum m} {~datum g}}]))