summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@chimrod.com>2021-08-23 14:37:53 +0200
committerSébastien Dailly <sebastien@chimrod.com>2021-08-23 14:37:53 +0200
commit546afdcf2148087f3a90b69c23ea756550f64433 (patch)
treeac56c71393aacf0fade729e98eeecb1e87a88534 /src/bin
Initial commit
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/dune6
-rw-r--r--src/bin/transcriptor.ml23
2 files changed, 29 insertions, 0 deletions
diff --git a/src/bin/dune b/src/bin/dune
new file mode 100644
index 0000000..5d49b1d
--- /dev/null
+++ b/src/bin/dune
@@ -0,0 +1,6 @@
+(executables
+ (names
+ transcriptor
+ )
+ (libraries translator)
+ )
diff --git a/src/bin/transcriptor.ml b/src/bin/transcriptor.ml
new file mode 100644
index 0000000..2378c5d
--- /dev/null
+++ b/src/bin/transcriptor.ml
@@ -0,0 +1,23 @@
+module T = Translator
+module P = T.Parser
+
+module Parser = P.Make(T.Sounds)
+module I = Parser.MenhirInterpreter
+
+let process (optional_line : string option) =
+ match optional_line with
+ | None -> ()
+ | Some line ->
+ match T.Reader.process line with
+ | Ok response -> print_endline response
+ | Error err -> print_endline err
+
+let rec repeat channel =
+ (* Attempt to read one line. *)
+ let optional_line, continue = T.Lexer.line channel in
+ process optional_line;
+ if continue then
+ repeat channel
+
+let () =
+ repeat (Lexing.from_channel stdin)