-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpr.rkt
89 lines (63 loc) · 1.46 KB
/
expr.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#lang typed/racket/shallow
(provide (all-defined-out))
(define-type Expr
(U elam eset epi esigma eone eunit
econ esum efun efst esnd eapp
evar evoid edecl etuple))
(struct elam
([patt : Patt]
[body : Expr])
#:transparent)
(struct eset
() #:transparent)
(struct etuple
([lhs : Expr]
[rhs : Expr]) #:transparent)
(struct epi
([pat : Patt]
[type : Expr]
[body : Expr]) #:transparent)
(struct esigma
([pat : Patt]
[type : Expr]
[body : Expr]) #:transparent)
(struct eone () #:transparent)
(struct eunit () #:transparent)
(struct econ
([name : Symbol]
[body : Expr]) #:transparent)
(struct esum
([branch : Branch]) #:transparent)
(struct efun
([branch : Branch]) #:transparent)
(struct efst
([exp : Expr]) #:transparent)
(struct esnd
([exp : Expr]) #:transparent)
(struct eapp
([rator : Expr]
[rand : Expr]) #:transparent)
(struct evar
([name : String]) #:transparent)
(struct evoid () #:transparent)
(struct edecl
([decl : Decl]
[body : Expr]) #:transparent)
(struct ddec
([patt : Patt]
[type : Expr]
[body : Expr]) #:transparent)
(struct drec
([patt : Patt]
[type : Expr]
[body : Expr]) #:transparent)
(define-type Decl (U ddec drec))
(struct ppair
([lhs : Patt]
[rhs : Patt]) #:transparent)
(struct pvar
([name : String]) #:transparent)
(struct pwild
() #:transparent)
(define-type Patt (U pvar ppair pwild))
(define-type Branch (Immutable-HashTable Symbol Expr))