notes and semi cleanup
This commit is contained in:
parent
c092fcf3a1
commit
774df1dd38
30
remix/README
30
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
|
TODO add syntax property for def transformer on RHS (for function call
|
||||||
results, alloc, etc)
|
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
|
(define (from-origin x) : posn
|
||||||
(posn x x))
|
(posn x x))
|
||||||
|
|
||||||
|
@ -24,20 +8,10 @@ p.x.real-part
|
||||||
|
|
||||||
(begin a (from-origin 5)).x
|
(begin a (from-origin 5)).x
|
||||||
|
|
||||||
|
TODO #%dot app syntax differently
|
||||||
|
|
||||||
obj.(move 5 6)
|
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
|
TODO robby's request
|
||||||
|
|
||||||
(haskell-style
|
(haskell-style
|
||||||
|
|
|
@ -12,4 +12,5 @@
|
||||||
(provide (rename-out
|
(provide (rename-out
|
||||||
[remix-module-begin #%module-begin])
|
[remix-module-begin #%module-begin])
|
||||||
#%semi
|
#%semi
|
||||||
|
unquote
|
||||||
require)
|
require)
|
||||||
|
|
|
@ -9,17 +9,13 @@
|
||||||
(define-syntax-class not-semi
|
(define-syntax-class not-semi
|
||||||
#:literals (#%semi unquote)
|
#:literals (#%semi unquote)
|
||||||
(pattern (~and (~not #%semi)
|
(pattern (~and (~not #%semi)
|
||||||
(~not (unquote #%semi)))))
|
(~not (unquote . _)))))
|
||||||
(define-splicing-syntax-class semi-piece
|
(define-splicing-syntax-class semi-piece
|
||||||
#:literals (#%semi unquote)
|
#:literals (#%semi unquote)
|
||||||
#:attributes (it)
|
#:attributes (it)
|
||||||
(pattern (~seq #%semi it))
|
(pattern (unquote it))
|
||||||
(pattern (~seq sp:not-semi ... #%semi)
|
(pattern (~seq sp:not-semi ... #%semi)
|
||||||
#:attr it #'(sp ...))
|
#: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 ...))))
|
|
||||||
(define-splicing-syntax-class semi-seq
|
(define-splicing-syntax-class semi-seq
|
||||||
#:attributes ([semi-form 1] [tail-form 1])
|
#:attributes ([semi-form 1] [tail-form 1])
|
||||||
(pattern (~seq s:semi-piece ... tail-form:not-semi ...)
|
(pattern (~seq s:semi-piece ... tail-form:not-semi ...)
|
||||||
|
|
|
@ -164,7 +164,7 @@
|
||||||
(syntax->list
|
(syntax->list
|
||||||
#'(output ...)))])))
|
#'(output ...)))])))
|
||||||
|
|
||||||
(define-syntax (the-#%braces stx)
|
(define-syntax (#%braces stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
[(_ input-tokens ...)
|
[(_ input-tokens ...)
|
||||||
(shunting-yard:consume-input
|
(shunting-yard:consume-input
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
empty
|
empty
|
||||||
empty)]))
|
empty)]))
|
||||||
|
|
||||||
(define-syntax (#%braces stx)
|
(define-syntax (block-#%braces stx)
|
||||||
(syntax-parse stx
|
(syntax-parse stx
|
||||||
[(_ s:semi-seq)
|
[(_ s:semi-seq)
|
||||||
(syntax-case #'(s.semi-form ...) ()
|
(syntax-case #'(s.semi-form ...) ()
|
||||||
|
@ -376,7 +376,6 @@
|
||||||
(rename-out [... …]) ;; \ldots
|
(rename-out [... …]) ;; \ldots
|
||||||
#%datum
|
#%datum
|
||||||
quote
|
quote
|
||||||
unquote
|
|
||||||
module
|
module
|
||||||
module*
|
module*
|
||||||
module+
|
module+
|
||||||
|
|
|
@ -8,17 +8,15 @@ require remix/stx0
|
||||||
remix/num/gen0;
|
remix/num/gen0;
|
||||||
;; A semi introduces a set of parens to its left
|
;; A semi introduces a set of parens to its left
|
||||||
|
|
||||||
;; If there is nothing to its left, then it ;-quotes what is to its
|
;; As usual `unquote` escapes from its context, in the case of a
|
||||||
;; right and makes it not introduce a set of parens
|
;; semi-sequence, this means that the term is not wrapped.
|
||||||
|
,(module+ test
|
||||||
|
;; This introduces ≡ as a testing form
|
||||||
|
|
||||||
;
|
;; XXX Drop this and instead have a macro for writing down
|
||||||
(module+ test
|
;; properties that communicates with boolean forms, etc. Supports ∀,
|
||||||
;; This introduces ≡ as a testing form
|
;; 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
|
;; define is replaced with def
|
||||||
def z 42;
|
def z 42;
|
||||||
|
@ -30,9 +28,8 @@ def x
|
||||||
(def a 40)
|
(def a 40)
|
||||||
(def b 2)
|
(def b 2)
|
||||||
(+ a b) ;
|
(+ a b) ;
|
||||||
;
|
,(module+ test
|
||||||
(module+ test
|
{x ≡ 42})
|
||||||
{x ≡ 42})
|
|
||||||
|
|
||||||
;; If you would like to use ;-syntax in the inside of def, then you
|
;; If you would like to use ;-syntax in the inside of def, then you
|
||||||
;; need more punctuation. You have two choices.
|
;; need more punctuation. You have two choices.
|
||||||
|
@ -40,25 +37,20 @@ def x2
|
||||||
[def a 40;
|
[def a 40;
|
||||||
def b 2;
|
def b 2;
|
||||||
(+ a b)];
|
(+ a b)];
|
||||||
;
|
,(module+ test
|
||||||
(module+ test
|
{x2 ≡ 42})
|
||||||
{x2 ≡ 42})
|
|
||||||
|
|
||||||
def x3
|
def x3
|
||||||
{def a 40;
|
[def a 40;
|
||||||
def b 2;
|
def b 2;
|
||||||
a + b};
|
{a + b}];
|
||||||
;
|
,(module+ test
|
||||||
(module+ test
|
{x3 ≡ 42})
|
||||||
{x3 ≡ 42})
|
|
||||||
|
|
||||||
;; If the kind of delimiters you want ; to introduce are {}s, then use
|
|
||||||
;; ,;
|
|
||||||
def x4
|
def x4
|
||||||
{a := 40,;
|
[,{a := 40}
|
||||||
b := 2,;
|
def b 2 ;
|
||||||
a + b};
|
{a + b}];
|
||||||
;
|
|
||||||
(module+ test
|
(module+ test
|
||||||
{x4 ≡ 42})
|
{x4 ≡ 42})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user