type op = 
  | Plus
  | Minus
  | Times
  | Div

type comp =
  | Lt
  | Gt
  | Lte
  | Gte
  | Eq
  | Neq
  | And
  | Or

type token = 
  | Tlident of string
  | Tuident of string
  | Tconst of int
  | Tbool of bool
  | Top of op
  | Tcomp of comp
  | Tlp         (* left/right parenthesis/crochet *)
  | Trp
  | Tlc
  | Trc
  | Tptv        (* point virgule *)
  | T2ptv       (* 2 points virgules *)
  | Tpt         (* point *)
  | T2pt        (* deux points *)
  | T2pteq      (* deux points egal *)
  | T22pt       (* 2 deux points *)
  | Tptex       (* point d'exclamation *)
  | Tif
  | Tthen
  | Telse
  | Tlet
  | Tin
  | Tmatch
  | Tmod
  | Tmodule
  | Topen
  | Trec
  | Tsig
  | Tstruct
  | Tval
  | Twith
  | Tend
  | Teof

let print_op = function
  | Plus -> Printf.printf "Plus\n"
  | Minus -> Printf.printf "Minus\n"
  | Times -> Printf.printf "Times\n"
  | Div -> Printf.printf "Div\n"

let print_comp = function
  | Lt -> Printf.printf "Lt\n"
  | Gt -> Printf.printf "Gt\n"
  | Lte -> Printf.printf "Lte\n"
  | Gte -> Printf.printf "Gte\n"
  | Eq -> Printf.printf "Eq\n"
  | Neq -> Printf.printf "Neq\n"
  | And -> Printf.printf "And\n"
  | Or -> Printf.printf "Or\n"

let print_token = function
  | Tlident s -> Printf.printf "Tlident %s\n" s
  | Tuident s -> Printf.printf "Tuident %s\n" s
  | Tconst d -> Printf.printf "Tconst %d\n" d
  | Tbool b -> Printf.printf "Tbool %B\n" b
  | Top op -> Printf.printf "Top"; print_op op
  | Tcomp comp -> Printf.printf "Tcomp"; print_comp comp
  | Tlp -> Printf.printf "Tlp\n"
  | Trp -> Printf.printf "Trp\n"
  | Tlc -> Printf.printf "Tlc\n"
  | Trc -> Printf.printf "Tlp\n"
  | Tptv -> Printf.printf "Tptv\n"
  | T2ptv -> Printf.printf "T2ptv\n"
  | Tpt -> Printf.printf "Tpt\n"
  | T2pt -> Printf.printf "T2pt\n"
  | T2pteq -> Printf.printf "T2pteq\n"
  | T22pt -> Printf.printf "T22pt\n"
  | Tptex -> Printf.printf "Tptex\n"
  | Tif -> Printf.printf "Tif\n"
  | Tthen -> Printf.printf "Tthen\n"
  | Telse -> Printf.printf "Telse\n"
  | Tlet -> Printf.printf "Tlet\n"
  | Tin -> Printf.printf "Tin\n"
  | Tmatch -> Printf.printf "Tmatch\n"
  | Tmod -> Printf.printf "Tmod\n"
  | Tmodule -> Printf.printf "Tmodule\n"
  | Topen -> Printf.printf "Topen\n"
  | Trec -> Printf.printf "Trec\n"
  | Tsig -> Printf.printf "Tsig\n"
  | Tstruct -> Printf.printf "Tstruct\n"
  | Tval -> Printf.printf "Tval\n"
  | Twith -> Printf.printf "Twith\n"
  | Tend -> Printf.printf "Tend\n"
  | Teof -> Printf.printf "Teof\n"
