Merge in changes to Syntax types from Carl.

svn: r15156
This commit is contained in:
Sam Tobin-Hochstadt 2009-06-12 20:53:47 +00:00
parent 7b82069fa0
commit bc6d606a60
4 changed files with 45 additions and 21 deletions

View File

@ -543,9 +543,11 @@
[datum->syntax [datum->syntax
(-poly (-poly
(a) (a)
(let* ([I (-Syntax Sym)] (let* ([Pre Syntax-Sexp]
[I (-Syntax Sym)]
[A Any-Syntax]
[S (-Syntax Univ)] [S (-Syntax Univ)]
[ctxt (-opt S)] [ctxt (-opt S)]
[srclist (-Tuple (list [srclist (-Tuple (list
Univ Univ
(-opt -Integer) (-opt -Integer)
@ -557,15 +559,20 @@
[cert (-opt S)]) [cert (-opt S)])
(cl->* (cl->*
(-> ctxt Sym I) (-> ctxt Sym I)
(-> ctxt Pre A)
(-> ctxt Univ S) (-> ctxt Univ S)
(-> ctxt Sym srcloc I) (-> ctxt Sym srcloc I)
(-> ctxt Pre srcloc A)
(-> ctxt Univ srcloc S) (-> ctxt Univ srcloc S)
(-> ctxt Sym srcloc prop I) (-> ctxt Sym srcloc prop I)
(-> ctxt Pre srcloc prop A)
(-> ctxt Univ srcloc prop S) (-> ctxt Univ srcloc prop S)
(-> ctxt Sym srcloc prop cert I) (-> ctxt Sym srcloc prop cert I)
(-> ctxt Pre srcloc prop cert A)
(-> ctxt Univ srcloc prop cert S))))] (-> ctxt Univ srcloc prop cert S))))]
[syntax->datum (-> (-Syntax Univ) Univ)] [syntax->datum (cl->* (-> Any-Syntax -Sexp)
(-> (-Syntax Univ) Univ))]
[syntax-e (-poly (a) (-> (-Syntax a) a))] [syntax-e (-poly (a) (-> (-Syntax a) a))]
[syntax-original? (-poly (a) (-> (-Syntax a) B))] [syntax-original? (-poly (a) (-> (-Syntax a) B))]
[identifier? (make-pred-ty (-Syntax Sym))] [identifier? (make-pred-ty (-Syntax Sym))]

View File

@ -17,8 +17,12 @@
[Output-Port -Output-Port] [Output-Port -Output-Port]
[Bytes -Bytes] [Bytes -Bytes]
[EOF (-val eof)] [EOF (-val eof)]
[Syntax Any-Syntax] [Sexpof (-poly (a) (-Sexpof a))] ;; recursive union of sexps with a
[Syntaxof (-poly (a) (-Syntax a))] [Syntaxof (-poly (a) (-Syntax a))] ;; syntax-e yields a
[Syntax-E In-Syntax] ;; possible results of syntax-e on "2D" syntax
[Syntax Any-Syntax] ;; (Syntaxof Syntax-E): "2D" syntax
[Datum Syntax-Sexp] ;; (Sexpof Syntax), datum->syntax yields "2D" syntax
[Sexp -Sexp] ;; (Sexpof (U)), syntax->datum of "2D" syntax
[Identifier Ident] [Identifier Ident]
[Procedure top-func] [Procedure top-func]
[Keyword -Keyword] [Keyword -Keyword]

View File

@ -18,6 +18,7 @@
;; convenient constructors ;; convenient constructors
(define -App make-App)
(define -pair make-Pair) (define -pair make-Pair)
(define -val make-Value) (define -val make-Value)
(define -Param make-Param) (define -Param make-Param)
@ -98,21 +99,6 @@
(define -Nat -Integer) (define -Nat -Integer)
(define -Real -Number) (define -Real -Number)
(define Any-Syntax
(-mu x
(-Syntax (*Un
-Number
-Boolean
-Symbol
-String
-Keyword
(-mu y (*Un (-val '()) (-pair x (*Un x y))))
(make-Vector x)
(make-Box x)))))
(define Ident (-Syntax -Symbol))
(define -Sexp (-mu x (*Un (-val null) -Number -Boolean -Symbol -String (-pair x x))))
(define -Port (*Un -Output-Port -Input-Port)) (define -Port (*Un -Output-Port -Input-Port))
(define -Pathlike (*Un -String -Path)) (define -Pathlike (*Un -String -Path))

View File

@ -44,4 +44,31 @@
;; DO NOT USE if t contains #f ;; DO NOT USE if t contains #f
(define (-opt t) (Un (-val #f) t)) (define (-opt t) (Un (-val #f) t))
(define In-Syntax
(-mu e
(*Un -Number -Boolean -Symbol -String -Keyword -Char
(make-Vector (-Syntax e))
(make-Box (-Syntax e))
(-mu list
(*Un (-val '())
(-pair (-Syntax e)
(*Un (-Syntax e) list)))))))
(define Any-Syntax (-Syntax In-Syntax))
(define (-Sexpof t)
(-mu sexp
(Un -Number -Boolean -Symbol -String -Keyword -Char
(-val '())
(-pair sexp sexp)
(make-Vector sexp)
(make-Box sexp)
t)))
(define -Sexp (-Sexpof (Un)))
(define Syntax-Sexp (-Sexpof Any-Syntax))
(define Ident (-Syntax -Symbol))