summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rw-r--r--bin/dune3
-rw-r--r--bin/main.ml12
2 files changed, 13 insertions, 2 deletions
diff --git a/bin/dune b/bin/dune
index 33c70b5..edad4dc 100644
--- a/bin/dune
+++ b/bin/dune
@@ -1,4 +1,5 @@
(executable
(public_name agate)
(name main)
- (libraries agate))
+ (libraries agate sedlex)
+ (preprocess (pps sedlex.ppx)))
diff --git a/bin/main.ml b/bin/main.ml
index 7bf6048..de7cd87 100644
--- a/bin/main.ml
+++ b/bin/main.ml
@@ -1 +1,11 @@
-let () = print_endline "Hello, World!"
+let rec token buf =
+ match%sedlex buf with
+ | white_space -> token buf
+ | "a" -> token buf
+ | "b" -> 2
+ | eof -> 0
+ | _ -> failwith "Unknown token"
+
+let () =
+ let lexbuf = Sedlexing.Utf8.from_string "ab" in
+ print_newline (print_int (token lexbuf))