19 lines
524 B
Racket
19 lines
524 B
Racket
#lang typed/racket
|
||
|
||
(define-type ConId Integer)
|
||
(define-type Arity Integer)
|
||
(define-type Let (∪ 'let 'letrec))
|
||
(define-type Name Symbol)
|
||
|
||
|
||
(define-type (Bind A) (List A (Expr A)))
|
||
(define-type (Alt A) (List 'branch ConId (Listof A) (Expr A)))
|
||
|
||
(define-type (Expr A)
|
||
(∪ Name
|
||
Integer
|
||
(List 'pack ConId Arity)
|
||
(List (Expr A) (Expr A))
|
||
(List Let (Pair (Bind A) (Listof (Bind A))) (Expr A))
|
||
(List 'case (Expr A) (Pair (Alt A) (Listof (Alt A))))
|
||
(List 'λ (Pair Name (Listof Name)) (Expr A))))
|