Module M_syntax

module M_syntax: sig .. end
Abstract syntax for the M language.

type id = Identifier.t 
type binOp = 
| Plus
| Minus
| Times
| LT
| GT
| EQ
type typ = 
| TInt (*int*)
| TBool (*bool*)
| TFun of typ * typ (*t_1 -> t_2*)
| TTuple of typ list (*t_1 * ... * t_n*)
| TList of typ (*t list*)
type exp = 
| Int of int (*decimal integer*)
| Bool of bool (*either true or false*)
| BinOp of binOp * exp * exp (*e1 + e2, e1 - e2, e1 * e2, e1 < e2, e1 > e2, or e1 = e2*)
| If of exp * exp * exp (*if e1 then e2 else e2*)
| Id of id (*first charater must be a letter or an underscore; remaining characters may include letters, numbers, and underscores*)
| Let of id * exp * exp (*let x = e1 in e2*)
| Fun of id * typ * exp (*fun (x : t) -> e*)
| Fix of id * typ * exp (*fix (x : t) -> e*)
| App of exp * exp (*e1 e2*)
| Empty of typ (*empty<t>*)
| Cons of exp * exp (*e1 :: e2*)
| Head of exp (*head e*)
| Tail of exp (*tail e*)
| IsEmpty of exp (*empty? e*)
| Tuple of exp list (*(e_1, ..., e_n)*)
| Proj of exp * int (*e.n*)
| Read of typ (*read<t> reads an expression of type t*)
| Write of exp (*write(e) prints a newline after the expression*)