view examples/OCaml-Kaleidoscope/Chapter7/token.ml @ 116:a609e5c42ecc

change from CGF to this
author mir3636
date Mon, 08 Aug 2016 19:47:00 +0900
parents 95c75e76d11b
children
line wrap: on
line source

(*===----------------------------------------------------------------------===
 * Lexer Tokens
 *===----------------------------------------------------------------------===*)

(* The lexer returns these 'Kwd' if it is an unknown character, otherwise one of
 * these others for known things. *)
type token =
  (* commands *)
  | Def | Extern

  (* primary *)
  | Ident of string | Number of float

  (* unknown *)
  | Kwd of char

  (* control *)
  | If | Then | Else
  | For | In

  (* operators *)
  | Binary | Unary

  (* var definition *)
  | Var