#lang scheme/base
(provide (all-defined-out))
(define-struct expr:lit (type value) #:prefab)
(define-struct expr:binop (op left right) #:prefab)
(define (expr? x)
(or (expr:lit? x)
(expr:binop? x)))
(define-struct decl:type:def (root defs) #:prefab)
(define-struct decl:type:tagged (type) #:prefab)
(define (decl? x)
(or (decl:type:def? x)
(decl:type:tagged? x)))
(define-struct type:ref (name) #:prefab)
(define-struct type:struct (tag fields) #:prefab)
(define-struct type:union (tag variants) #:prefab)
(define-struct type:enum (tag variants) #:prefab)
(define-struct type:array (type size) #:prefab)
(define-struct type:pointer (type) #:prefab)
(define-struct type:function (return args) #:prefab)
(define (type? x)
(or (type:ref? x)
(type:struct? x)
(type:union? x)
(type:enum? x)
(type:array? x)
(type:pointer? x)
(type:function? x)))