Syntax parse in redex-lang forms
For better errors and more robust extensions
This commit is contained in:
parent
59e241ecb2
commit
e334376433
|
@ -410,8 +410,9 @@
|
||||||
;;
|
;;
|
||||||
;; TODO: Can these be simplified further?
|
;; TODO: Can these be simplified further?
|
||||||
(define-syntax (dep-lambda syn)
|
(define-syntax (dep-lambda syn)
|
||||||
(syntax-case syn (:)
|
(syntax-parse syn
|
||||||
[(_ (x : t) e)
|
#:datum-literals (:)
|
||||||
|
[(_ (x:id : t) e)
|
||||||
(syntax->curnel-syntax
|
(syntax->curnel-syntax
|
||||||
(quasisyntax/loc syn (λ (x : t) e)))]))
|
(quasisyntax/loc syn (λ (x : t) e)))]))
|
||||||
|
|
||||||
|
@ -422,28 +423,30 @@
|
||||||
(quasisyntax/loc syn (#%app e1 e2)))]))
|
(quasisyntax/loc syn (#%app e1 e2)))]))
|
||||||
|
|
||||||
(define-syntax (dep-forall syn)
|
(define-syntax (dep-forall syn)
|
||||||
(syntax-case syn (:)
|
(syntax-parse syn
|
||||||
[(_ (x : t) e)
|
#:datum-literals (:)
|
||||||
|
[(_ (x:id : t) e)
|
||||||
(syntax->curnel-syntax
|
(syntax->curnel-syntax
|
||||||
(quasisyntax/loc syn (Π (x : t) e)))]))
|
(quasisyntax/loc syn (Π (x : t) e)))]))
|
||||||
|
|
||||||
(define-syntax (Type syn)
|
(define-syntax (Type syn)
|
||||||
(syntax-case syn ()
|
(syntax-parse syn
|
||||||
[(_ i)
|
[(_ i:nat)
|
||||||
(syntax->curnel-syntax
|
(syntax->curnel-syntax
|
||||||
(quasisyntax/loc syn (Unv i)))]
|
(quasisyntax/loc syn (Unv i)))]
|
||||||
[_ (quasisyntax/loc syn (Type 0))]))
|
[_ (quasisyntax/loc syn (Type 0))]))
|
||||||
|
|
||||||
(define-syntax (dep-inductive syn)
|
(define-syntax (dep-inductive syn)
|
||||||
(syntax-case syn (:)
|
(syntax-parse syn
|
||||||
[(_ i : ti (x1 : t1) ...)
|
#:datum-literals (:)
|
||||||
|
[(_ i:id : ti (x1:id : t1) ...)
|
||||||
(begin
|
(begin
|
||||||
(extend-Δ/syn! delta #'i #'ti #'((x1 : t1) ...))
|
(extend-Δ/syn! delta #'i #'ti #'((x1 : t1) ...))
|
||||||
#'(void))]))
|
#'(void))]))
|
||||||
|
|
||||||
(define-syntax (dep-elim syn)
|
(define-syntax (dep-elim syn)
|
||||||
(syntax-case syn ()
|
(syntax-parse syn
|
||||||
[(_ D T)
|
[(_ D:id T)
|
||||||
(syntax->curnel-syntax
|
(syntax->curnel-syntax
|
||||||
(quasisyntax/loc syn (elim D T)))]))
|
(quasisyntax/loc syn (elim D T)))]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user