Module Ast.TypedAst

AST with types

type value =
| VInt of int64
| VInt32 of int32
| VString of string
| VBool of bool

value are the possible values for the dyri language

type typ =
| TSeq of typ * typ
| TInt
| TInt32
| TString
| TBool
| TCustom of string
| TVar of tvar

typ are the possible types for the language After the typing stage every variable will have one of these types typ ::= | int | bool | str | typ -> typ | None

and tvar = {
id : int;
mutable def : typ option;
}
type op =
| Add
| Sub
| Div
| Mul
| Mod

op are the available operatores Add + Sub - Div / Mul * Mod %

type stmt = {
typ : typ;
desc : desc;
}

stmt this is a stmt, it's created one for each stmt parsed

and desc =
| Const of value
| Op of stmt * op * stmt
| Var of string
| Apply of string * stmt list
| Let of string * stmt
| Fun of string * stmt
| AnFun of string * stmt
| If
| For
| Loop(*

Block have a return typ

*)
| Block of stmt list

desc possible statements to use inside the Dyri language

type code = stmt list

code stores all the AST code from a string/file