Module Touist.Types.Ast

type var = string * t list option
type t =
| Touist_code of t list
| Int of int
| Float of float
| Bool of bool
| Var of var
| Set of AstSet.t
| Set_decl of t list
| Neg of t
| Add of t * t
| Sub of t * t
| Mul of t * t
| Div of t * t
| Mod of t * t
| Sqrt of t
| To_int of t
| To_float of t
| Abs of t
| Top
| Bottom
| Not of t
| And of t * t
| Or of t * t
| Xor of t * t
| Implies of t * t
| Equiv of t * t
| Equal of t * t
| Not_equal of t * t
| Lesser_than of t * t
| Lesser_or_equal of t * t
| Greater_than of t * t
| Greater_or_equal of t * t
| Union of t * t
| Inter of t * t
| Diff of t * t
| Range of t * t
| Empty of t
| Card of t
| Subset of t * t
| Powerset of t
| In of t * t
| If of t * t * t
| Exact of t * t
| Atleast of t * t
| Atmost of t * t
| Bigand of t list * t list * t option * t
| Bigor of t list * t list * t option * t
| Let of t * t * t
| Affect of t * t
| UnexpProp of string * t list option

(** UnexpProp is a proposition that contains unexpanded variables; we cannot tranform UnexpProp into Prop before knowing what is the content of the variables. Examples:

            abcd(1,$d,$i,a)       <- not a full-string yet

*)

| Prop of string

(** Prop contains the actual proposition after the evaluation has been run. Example: if $d=foo and $i=123, then the Prop is:

            abcd(1,foo,123,a)     <- an actual string that represents an actual
                                    logical proposition

*)

| Loc of t * Err.loc

(** Loc is a clever (or ugly, you pick) way of keeping the locations in the text of the Ast.t elements. In parser.mly, each production rule gives its location in the original text; for example, instead of simply returning Inter (x,y) the parser will return Loc (Inter (x,y), ($startpos,$endpos)).

Loc is used in eval.ml when checking the types; it allows to give precise locations. *)

| Paren of t

(** Paren keeps track of the parenthesis in the AST in order to print latex *)

| Exists of t * t
| Forall of t * t
| For of t * t * t
| NewlineAfter of t
| NewlineBefore of t
| Formula of t
| SetBuilder of t * t list * t list * t option