summaryrefslogtreecommitdiff
path: root/testsuite/tests/tool-lexyacc/calc.ml
blob: ec2bb79572609e20863b5808688428b36ae10ac9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
(* TEST
   modules = "calc_parser.mly calc_lexer.mll"
   ocamllex_flags = " -q "
   ocamlyacc_flags = " -q "
   readonly_files = "calc_input.txt"
   stdin = "calc_input.txt"
*)
let _ =
  try
    let lexbuf = Lexing.from_channel stdin in
    while true do
      let result = Calc_parser.main Calc_lexer.token lexbuf in
        print_int result; print_newline(); flush stdout
    done
  with Calc_lexer.Eof ->
    exit 0