Skip to content

Commit e106f06

Browse files
author
Ioana
committed
parse rules
1 parent 1ca935d commit e106f06

File tree

3 files changed

+43
-26
lines changed

3 files changed

+43
-26
lines changed

main.ml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
let files = ref []
22
let formula_file = ref ""
3+
let rule_file = ref ""
34
let read_fm = ref []
5+
let read_rule = ref []
46
let debug_mode = ref false
57

68
let options = [
7-
("-f", Arg.Set_string formula_file, "file name skeleton for outputs");
9+
("-f", Arg.Set_string formula_file, "file name for formulas");
10+
("-r", Arg.Set_string rule_file, "file name for rules");
811
("-debug", Arg.Set debug_mode, "print internal info");]
912

1013
let test_z3 t =
@@ -50,6 +53,20 @@ let parse_fm () =
5053
done
5154
with Lexer.Eof -> ()
5255

56+
let parse_rules () =
57+
let () = if (!Parameter.debug_mode) then
58+
Format.printf "parse file %s\n" (!rule_file) in
59+
let chan = open_in (!rule_file) in
60+
try
61+
let lexbuf = Lexing.from_channel chan in
62+
while true do
63+
let result = ParserRule.newline LexerRule.token lexbuf in
64+
read_rule := result::(!read_rule);
65+
if (!Parameter.debug_mode) then
66+
(Format.printf "parsing \n"; Ast.print result;Format.printf"\n")
67+
done
68+
with LexerRule.Eof -> ()
69+
5370
let set_flags () =
5471
Parameter.debug_mode := !debug_mode
5572

@@ -80,7 +97,7 @@ let () =
8097
(Sys.argv.(0) ^
8198
" stories\n outil") in
8299
let () = set_flags () in
83-
(* let () = parse_fm () in*)
100+
let () = parse_rules () in
84101
let posets = Domain.set_posets (!files) in
85102
()
86103
(* test_z3 posets*)

site_graph.ml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -229,28 +229,28 @@ let pushout graph1 graph2 =
229229
if (check_site_graph graph) then (Some graph)
230230
else None
231231

232-
let test_check_site_graphs =
233-
if (check_site_graph bad_graph1) then Format.printf "bad1 : site graph\n"
234-
else Format.printf "bad1 : not a site graphs\n";
235-
if (check_site_graph test_graph5) then Format.printf "graph5 : site graph\n"
236-
else Format.printf "graph5 : not a site graphs\n";
237-
if (check_site_graph bad_graph3) then Format.printf "bad3 : site graph\n"
238-
else Format.printf "bad3 : not a site graphs\n";
239-
if (check_site_graph bad_graph4) then Format.printf "bad4 : site graph\n"
240-
else Format.printf "bad4 : not a site graphs\n";
241-
Format.printf "\n\n"
232+
(* let test_check_site_graphs = *)
233+
(* if (check_site_graph bad_graph1) then Format.printf "bad1 : site graph\n" *)
234+
(* else Format.printf "bad1 : not a site graphs\n"; *)
235+
(* if (check_site_graph test_graph5) then Format.printf "graph5 : site graph\n" *)
236+
(* else Format.printf "graph5 : not a site graphs\n"; *)
237+
(* if (check_site_graph bad_graph3) then Format.printf "bad3 : site graph\n" *)
238+
(* else Format.printf "bad3 : not a site graphs\n"; *)
239+
(* if (check_site_graph bad_graph4) then Format.printf "bad4 : site graph\n" *)
240+
(* else Format.printf "bad4 : not a site graphs\n"; *)
241+
(* Format.printf "\n\n" *)
242242

243-
let test_pushout =
244-
let () =
245-
match (pushout test_graph1 test_graph2) with
246-
| Some gr -> Format.printf "pushout 1, 2: \n"; print_graph gr
247-
| None -> Format.printf "pushout not a site graphs\n" in
248-
Format.printf "\n\n";
249-
let () =
250-
match (pushout test_graph3 test_graph4) with
251-
| Some gr -> Format.printf "pushout 3, 4:\n"; print_graph gr
252-
| None -> Format.printf "pushout not a site graphs\n" in
253-
()
243+
(* let test_pushout = *)
244+
(* let () = *)
245+
(* match (pushout test_graph1 test_graph2) with *)
246+
(* | Some gr -> Format.printf "pushout 1, 2: \n"; print_graph gr *)
247+
(* | None -> Format.printf "pushout not a site graphs\n" in *)
248+
(* Format.printf "\n\n"; *)
249+
(* let () = *)
250+
(* match (pushout test_graph3 test_graph4) with *)
251+
(* | Some gr -> Format.printf "pushout 3, 4:\n"; print_graph gr *)
252+
(* | None -> Format.printf "pushout not a site graphs\n" in *)
253+
(* () *)
254254

255-
let test () =
256-
test_pushout
255+
(* let test () = *)
256+
(* test_pushout *)

site_graph.mli

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@ type t = {
2020
}
2121

2222
val print_graph : t -> unit
23-
val test : unit -> unit
23+
(*val test : unit -> unit*)

0 commit comments

Comments
 (0)