From 546afdcf2148087f3a90b69c23ea756550f64433 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Mon, 23 Aug 2021 14:37:53 +0200 Subject: Initial commit --- src/bin/dune | 6 ++++++ src/bin/transcriptor.ml | 23 +++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 src/bin/dune create mode 100644 src/bin/transcriptor.ml (limited to 'src/bin') 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) -- cgit v1.2.3