Add pretty printer (still wip)
This commit is contained in:
parent
bb0e9f68a8
commit
7d0135ed25
1 changed files with 7 additions and 3 deletions
10
ast.rkt
10
ast.rkt
|
@ -6,15 +6,17 @@
|
|||
|
||||
|
||||
(define-type (Bind A) (List A (Expr A)))
|
||||
(define-type (Binds A) (Pair (Bind A) (Listof (Bind A))))
|
||||
(define-type (Alt A) (List 'branch ConId (Listof A) (Expr A)))
|
||||
(define-type (Alts A) (Pair (Alt A) (Listof (Alt 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 Let (Binds A) (Expr A))
|
||||
(List 'case (Expr A) (Alts A))
|
||||
(List 'λ (Pair Name (Listof Name)) (Expr A))))
|
||||
|
||||
(define-type (ScDefn A) (List 'define (Pair Name (Listof A)) (Expr A)))
|
||||
|
@ -24,5 +26,7 @@
|
|||
(define-type CoreProgram (Program Name))
|
||||
(define-type CoreBind (Bind Name))
|
||||
(define-type CoreAlt (Alt Name))
|
||||
(define-type CoreBinds (Binds Name))
|
||||
(define-type CoreAlts (Alts Name))
|
||||
|
||||
(provide CoreExpr CoreScDefn CoreProgram CoreBind CoreAlt Expr Bind Alt Name Let Arity ConId)
|
||||
(provide CoreExpr CoreScDefn CoreProgram CoreBind CoreAlt Expr Bind Alt Name Let Arity ConId CoreAlts CoreBinds)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue