-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathspinr.ml
More file actions
22 lines (21 loc) · 770 Bytes
/
Copy pathspinr.ml
File metadata and controls
22 lines (21 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
(* set up for command argument
using Sys and Arg modules *)
let usage = "usage: " ^ Sys.argv.(0) ^ " <filename>"
let file = ref ""
(* main program *)
let main =
(* Read the arguments of command *)
Arg.parse [] (fun s -> file := s) usage;
if String.length !file == 0 then print_endline usage
else
let _ = print_endline "Loading Promela Model ..." in
let (s,p) = Parser.parse_file !file in
let _ = print_endline (" "^s) in
let _ = print_endline (" as ") in
let _ = (Promela.Model.to_channel stdout p) in
let _ = print_endline "Refining to C ..." in
let c = Promela.Refine.translate_model p in
let s = (Promela.Refine.string_of_prog c) in
let _ = print_endline s in
let oc = open_out ((!file)^".c") in
output_string oc s