aboutsummaryrefslogtreecommitdiff
path: root/examples/OCaml-Kaleidoscope/Chapter2/token.ml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/OCaml-Kaleidoscope/Chapter2/token.ml')
-rw-r--r--examples/OCaml-Kaleidoscope/Chapter2/token.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/OCaml-Kaleidoscope/Chapter2/token.ml b/examples/OCaml-Kaleidoscope/Chapter2/token.ml
new file mode 100644
index 0000000000..2ca782e149
--- /dev/null
+++ b/examples/OCaml-Kaleidoscope/Chapter2/token.ml
@@ -0,0 +1,15 @@
+(*===----------------------------------------------------------------------===
+ * 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