diff options
author | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-23 14:37:53 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@chimrod.com> | 2021-08-23 14:37:53 +0200 |
commit | 546afdcf2148087f3a90b69c23ea756550f64433 (patch) | |
tree | ac56c71393aacf0fade729e98eeecb1e87a88534 /src/bin/transcriptor.ml |
Initial commit
Diffstat (limited to 'src/bin/transcriptor.ml')
-rw-r--r-- | src/bin/transcriptor.ml | 23 |
1 files changed, 23 insertions, 0 deletions
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) |