diff --git a/remix/README b/remix/README index e251262..ee9fe3c 100644 --- a/remix/README +++ b/remix/README @@ -1,22 +1,6 @@ -TODO add ; as #%semicolon that adds ()s between occurrences - TODO add syntax property for def transformer on RHS (for function call results, alloc, etc) -TODO maybe add , as special - -TODO #%dot is extensible transformer - -(struct posn ((complex x) y)) - -(define (f (posn p)) - p.x.real-part) - -p.x.real-part -(#%dot (#%dot p x) real-part) -(let ([(complex tmp) (posn-x p)]) - (#%dot tmp real-part)) - (define (from-origin x) : posn (posn x x)) @@ -24,20 +8,10 @@ p.x.real-part (begin a (from-origin 5)).x +TODO #%dot app syntax differently + obj.(move 5 6) -(define (f (cons x y)) - stuff) -(define (f (a-cons p)) - stuff) - -(define (f [: b box]) - stuff) -(define (f box.b) - stuff) -(define (f (box x)) - stuff) - TODO robby's request (haskell-style diff --git a/remix/core.rkt b/remix/core.rkt index d1474de..6de29c9 100644 --- a/remix/core.rkt +++ b/remix/core.rkt @@ -12,4 +12,5 @@ (provide (rename-out [remix-module-begin #%module-begin]) #%semi + unquote require) diff --git a/remix/semi.rkt b/remix/semi.rkt index abc60d0..7a00a32 100644 --- a/remix/semi.rkt +++ b/remix/semi.rkt @@ -9,17 +9,13 @@ (define-syntax-class not-semi #:literals (#%semi unquote) (pattern (~and (~not #%semi) - (~not (unquote #%semi))))) + (~not (unquote . _))))) (define-splicing-syntax-class semi-piece #:literals (#%semi unquote) #:attributes (it) - (pattern (~seq #%semi it)) + (pattern (unquote it)) (pattern (~seq sp:not-semi ... #%semi) - #:attr it #'(sp ...)) - (pattern (~seq sp:not-semi ... (~and uqs (unquote #%semi))) - #:attr it - (with-syntax ([semi-#%braces (datum->syntax #'uqs '#%braces)]) - #'(semi-#%braces sp ...)))) + #:attr it #'(sp ...))) (define-splicing-syntax-class semi-seq #:attributes ([semi-form 1] [tail-form 1]) (pattern (~seq s:semi-piece ... tail-form:not-semi ...) diff --git a/remix/stx0.rkt b/remix/stx0.rkt index 0c884e4..dbff74f 100644 --- a/remix/stx0.rkt +++ b/remix/stx0.rkt @@ -164,7 +164,7 @@ (syntax->list #'(output ...)))]))) -(define-syntax (the-#%braces stx) +(define-syntax (#%braces stx) (syntax-parse stx [(_ input-tokens ...) (shunting-yard:consume-input @@ -172,7 +172,7 @@ empty empty)])) -(define-syntax (#%braces stx) +(define-syntax (block-#%braces stx) (syntax-parse stx [(_ s:semi-seq) (syntax-case #'(s.semi-form ...) () @@ -376,7 +376,6 @@ (rename-out [... …]) ;; \ldots #%datum quote - unquote module module* module+ diff --git a/remix/tests/simple.rkt b/remix/tests/simple.rkt index 5d4a323..cd186fc 100644 --- a/remix/tests/simple.rkt +++ b/remix/tests/simple.rkt @@ -8,17 +8,15 @@ require remix/stx0 remix/num/gen0; ;; A semi introduces a set of parens to its left -;; If there is nothing to its left, then it ;-quotes what is to its -;; right and makes it not introduce a set of parens +;; As usual `unquote` escapes from its context, in the case of a +;; semi-sequence, this means that the term is not wrapped. +,(module+ test + ;; This introduces ≡ as a testing form -; -(module+ test - ;; This introduces ≡ as a testing form - - ;; XXX Drop this and instead have a macro for writing down - ;; properties that communicates with boolean forms, etc. Supports ∀, - ;; etc. - (require remix/test0)) + ;; XXX Drop this and instead have a macro for writing down + ;; properties that communicates with boolean forms, etc. Supports ∀, + ;; etc. + (require remix/test0)) ;; define is replaced with def def z 42; @@ -30,9 +28,8 @@ def x (def a 40) (def b 2) (+ a b) ; -; -(module+ test - {x ≡ 42}) +,(module+ test + {x ≡ 42}) ;; If you would like to use ;-syntax in the inside of def, then you ;; need more punctuation. You have two choices. @@ -40,25 +37,20 @@ def x2 [def a 40; def b 2; (+ a b)]; -; -(module+ test - {x2 ≡ 42}) +,(module+ test + {x2 ≡ 42}) def x3 - {def a 40; + [def a 40; def b 2; - a + b}; -; -(module+ test - {x3 ≡ 42}) + {a + b}]; +,(module+ test + {x3 ≡ 42}) -;; If the kind of delimiters you want ; to introduce are {}s, then use -;; ,; def x4 - {a := 40,; - b := 2,; - a + b}; -; + [,{a := 40} + def b 2 ; + {a + b}]; (module+ test {x4 ≡ 42})