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