1. Kota UENISHI
  2. ocaml-bert

Source

ocaml-bert / termreader.ml


print_endline "termreader:"

let _ = 
  let load_file filename = 
    let rec load channel data = 
      try 
	let line = Pervasives.input_line channel in
	  load channel (String.concat "" [data; line])
      with
	| End_of_file ->  
	    close_in channel;
	    data
    in
    let fch = open_in filename in (* opening file channel *)
      load fch ""
  in
  let result = Bert.decode_binary (load_file "termwriter.bert") in
    begin match result with
      | Bert.Ok(term, remain)->
	  Bert.print_erlterm term;
	  print_endline " all read.";
      | _->
	  print_endline " failed in decoding.";
    end;;