Module Ast.Ast


module Ast: sig .. end


type typerep =
| IntType
| FloatType
| StringType
| BoolType
| RelationType of string
| Unknown
Type representations.

type binop =
| Plus
| Minus
| Times
| Divide
LogLog basics.

type boolop =
| Equiv
| Nequiv
| Or
| And
| Lt
| Lte
| Gt
| Gte

type primexp =
| Float of float
| Integer of int
| String of string
| Bool of bool

type exp =
| PrimExp of primexp
| RelationExp of string * relation
| VarExp of var
| FunAppExp of string list
| Binop of binop * exp * exp
| Boolop of boolop * exp * exp
| SymExp of symexp (*Symbolic expression.*)
Expressions.

type symexp =
| SymVar of var (*Symbolic variables--this must come from reading input.*)
| SymExpr of exp (*Symbolic expression contains at least one reference to a symbolic variable somewhere. This exists in the form of a variable expression (Ast.VarExp).*)
| SymPred of exp * exp * exp (*Has a symbolic conditional.*)
Symbolic expressions.

Constraints.

type constraintexp =
| ACBoolop of boolop * constraintexp * constraintexp
| ACThis (*"this"*)
| ACVar of string
| ACPrev of string
| ACNext of string
| ACDrop of string (*Special "drop" keyword.*)
Constraint expression.

type constraintvalue =
| ConstraintForall of string * string list * constraintvalue
| ConstraintExists of string * string list * constraintvalue
| CValExp of constraintexp

type constraintbody =
| ConstraintAssume of constraintvalue list
| ConstraintAssert of constraintvalue list

type var =
| Var of string
| RecordIndexVar of string * string * int
| IndexVar of string * string (*Data gets stored with its constraints*)
Data fields for a record (i.e. one line of a file).
type datafields = exp MapUtils.StringMap.t 
type relation = datafields MapUtils.IntMap.t 
val empty_relation : relation

type stmt =
| AssignStmt of var * exp
| Cond of exp * stmt list * stmt list
| ForEachLoop of string * string * stmt list
| Return of exp
| Assert of exp
| Assume of exp
Statements show up in procedure bodies.

type userty = {
   dataname : string;
   fieldinfo : (string * typerep) list;
}
User-defined types can only be relation/record types.

type fundecl = {
   funname : string;
   funargs : (string * typerep) list;
   funbody : stmt list;
}
type datarhs =
| RhsExp of exp
| Concretize of exp
| CRange of exp
Things that can appear on the right-hand side of a top-level data * declaration.

type topdecl =
| TypeDecl of userty * constraintbody list (*Type declaration contains description of record type with additional * assumptions/assertions.*)
| FunDecl of fundecl (*Procedure declaration.*)
| AssignDecl of string * typerep * datarhs
Top-level declarations.