(* Types *)

type typ = 
  | Tunit
  | Tbool
  | Tint
  | Tref of typ
  | Tlist of typ

(* AST *)

type comp =
  | Ge | Le | Gt | Lt | Eq | Neq

type binop =
  | Add | Sub | Mul | Div | Mod
  | Comp of comp
  | And | Or | Concat | Assert | Semi          

type unop =
  | Minus | Excl

type cst =
  | Int of int
  | Bool of bool
  | Unit
  | EmptyList

type path = string list

type fargs = (string * typ) list

(* Signatures *)
type margs = (string * signature) list
and signature = decl list
and decl = 
  { decl_desc: decl_desc;
    decl_loc : Lexing.position * Lexing.position }
and decl_desc =
  | Val of string * (typ list)
  | ModuleS of string * margs * signature

(* Reste de l'AST *)
type program = elt list

and elt =
  { elt_desc: elt_desc;
    elt_loc : Lexing.position * Lexing.position }

and elt_desc = 
  | LetIgnore of expr
  | Let of bool * string * fargs * typ * expr
  | Module of string * margs * (signature option) * mexpr
  | Open of path

and expr =
  { expr_desc: expr_desc;
    expr_loc : Lexing.position * Lexing.position }

and expr_desc = 
  | Cst of cst
  | Var of path
  | App of path * (expr list)
  | Binop of binop * expr * expr
  | Unop of unop * expr
  | IfThenElse of expr * expr * expr
  | LetIn of string * expr * expr
  | MatchWith of expr * expr * string * string * expr

and mexpr = 
  { mexpr_desc: mexpr_desc;
    mexpr_loc : Lexing.position * Lexing.position }

and mexpr_desc =
  | Struct of elt list
  | Functor of path * (path list)
