Add file for AST
This commit is contained in:
parent
7776723a77
commit
1507c6c40f
1 changed files with 19 additions and 0 deletions
19
ast.rkt
Normal file
19
ast.rkt
Normal file
|
@ -0,0 +1,19 @@
|
|||
#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))))
|
Loading…
Add table
Add a link
Reference in a new issue