Module Interpret_lib.Ast

type id = string
type binop =
  1. | Add
    (*

    +

    *)
  2. | Sub
    (*

    -

    *)
  3. | Mul
    (*

    *

    *)
  4. | Div
    (*

    /

    *)
  5. | Eq
    (*

    =

    *)
  6. | Neq
    (*

    <>

    *)
  7. | Lt
    (*

    <

    *)
  8. | Le
    (*

    <=

    *)
  9. | Gt
    (*

    >

    *)
  10. | Ge
    (*

    >=

    *)
type rec_flag =
  1. | Rec
    (*

    let rec

    *)
  2. | NonRec
    (*

    let

    *)
type expr =
  1. | EConst of int
    (*

    integer literal: 42, -1

    *)
  2. | EVar of id
    (*

    variable: x, fact

    *)
  3. | EBinop of binop * expr * expr
    (*

    binary operation: e1 + e2

    *)
  4. | EIf of expr * expr * expr
    (*

    conditional: if c then e1 else e2

    *)
  5. | EFun of id * expr
    (*

    abstraction: fun x -> e

    *)
  6. | EApp of expr * expr
    (*

    application: f x

    *)
  7. | ELet of rec_flag * id * expr * expr
    (*

    binding: let (rec)? x = e1 in e2

    *)