Source file tokenTypes.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
type token =
  | LParen
  | LBrace
  | LBracket
  | RParen
  | RBrace
  | RBracket
  | Integer of int
  | Float of float
  | String of string
  | Symbol of string

let string_of_token (t : token) : string =
  match t with
  | LParen -> "("
  | LBrace -> "{"
  | LBracket -> "["
  | RParen -> ")"
  | RBrace -> "}"
  | RBracket -> "]"
  | Integer i -> string_of_int i
  | Float f -> string_of_float f
  | String s -> "\"" ^ s ^ "\""
  | Symbol s -> s