diff options
| author | Scott Lawrence <scott+git@ineffectivetheory.com> | 2024-06-25 21:11:01 -0700 |
|---|---|---|
| committer | Scott Lawrence <scott+git@ineffectivetheory.com> | 2024-06-25 21:11:01 -0700 |
| commit | 062d3944ee86c273ad3919993185d5901768ef2d (patch) | |
| tree | 585eeff84f1885c7d8748c267eb5ee171d3271e6 /bin/main.ml | |
| parent | 5c245e98d57be64bc329ba7b813a03260e6281c6 (diff) | |
| download | agate-062d3944ee86c273ad3919993185d5901768ef2d.tar.gz agate-062d3944ee86c273ad3919993185d5901768ef2d.tar.bz2 agate-062d3944ee86c273ad3919993185d5901768ef2d.zip | |
Attempting to use sedlex (and maybe Menhir)
Diffstat (limited to 'bin/main.ml')
| -rw-r--r-- | bin/main.ml | 12 |
1 files changed, 11 insertions, 1 deletions
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)) |
