type type_t =
| Void_t
| Int_t
| Bool_t
| Func_t of type_t * type_t list
module Syntax = struct
type ident = string
type value =
| Void
| Int of int
| Bool of bool
type expr =
| Val of
{ value : value
; pos : Lexing.position
}
| Var of
{ name : ident
| Call of
{ func : ident
; args : expr list
type instr =
| Decl of
; type_t : type_t
| Assign of
{ var : ident
; expr : expr
| Return of
{ expr : expr
and block = instr list
end
module IR = struct
| Val of value
| Var of ident
| Call of ident * expr list
| Decl of ident
| Assign of ident * expr
| Return of expr