core-in-racket/ast.rkt
2025-05-24 13:21:15 -04:00

19 lines
524 B
Racket
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#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))))