blob: 6d02e9d3aba71d25989d4e6cf83f048ff1c85483 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
module T = Translator
module P = T.Parser
module I = P.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)
|