1. Kota UENISHI
  2. ocaml-bert

Source

ocaml-bert / termreader.ml

UENISHI Kota 19d1fed 
UENISHI Kota 3aec550 
UENISHI Kota 19d1fed 












UENISHI Kota 3aec550 

UENISHI Kota 19d1fed 


UENISHI Kota 0c35e71 
UENISHI Kota 19d1fed 
UENISHI Kota 0c35e71 
UENISHI Kota 19d1fed 
UENISHI Kota 3aec550 


UENISHI Kota 0c35e71 
UENISHI Kota 3aec550 
UENISHI Kota 0c35e71 




let print_termfile filename = 
  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 filename) in
    Printf.printf "reading %s: \n" filename;
    begin match result with
      | Bert.Ok(term, remain)->
	  Bert.print_erlterm term;
	  print_endline "\n==all read.";
      | _->
	  print_endline "\n==failed in decoding.";
    end;;

let _ = 
  let argv = Array.to_list Sys.argv in
    print_string "==";
    match List.tl argv with
      | [] -> 
	  print_string "no files specified - ";
	  [print_termfile "termwriter.bert"];
      | list -> 
	  List.map print_termfile list;;