Commit 016365db authored by MARCHE Claude's avatar MARCHE Claude

Try why3: failed attempt to parse task with Alt-Ergo

Need to compile Alt-Ergo with Nums instead of Zarith,
which is not supported by js_of_ocaml
parent 7747ddde
...@@ -1426,8 +1426,15 @@ install_local:: bin/why3doc ...@@ -1426,8 +1426,15 @@ install_local:: bin/why3doc
# trywhy3 # trywhy3
######### #########
ALTERGODIR=src/trywhy3/alt-ergo-0.99.1
JSOCAMLC=ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.syntax \ JSOCAMLC=ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.syntax \
-syntax camlp4o -I src/trywhy3 -syntax camlp4o -I src/trywhy3 -I $(ALTERGODIR)/src/parsing
ALTERGOMODS=util/numbers util/version util/options parsing/why_parser parsing/why_lexer
TRYWHY3CMO=lib/why3/why3.cma
# $(addprefix $(ALTERGODIR)/src/, $(addsuffix .cmo,$(ALTERGOMODS)))
src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte
js_of_ocaml --extern-fs -I . -I src/trywhy3 --file=trywhy3.conf:/ \ js_of_ocaml --extern-fs -I . -I src/trywhy3 --file=trywhy3.conf:/ \
...@@ -1438,7 +1445,7 @@ src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte ...@@ -1438,7 +1445,7 @@ src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte
`find theories modules \( -name "*.mlw" -o -name "*.why" \) -printf " --file=%p:/"` \ `find theories modules \( -name "*.mlw" -o -name "*.why" \) -printf " --file=%p:/"` \
+weak.js +nat.js $^ +weak.js +nat.js $^
src/trywhy3/trywhy3.byte: lib/why3/why3.cma src/trywhy3/trywhy3.cmo src/trywhy3/trywhy3.byte: $(TRYWHY3CMO) src/trywhy3/trywhy3.cmo
$(JSOCAMLC) $(BFLAGS) -o $@ -linkpkg $(BLINKFLAGS) $^ $(JSOCAMLC) $(BFLAGS) -o $@ -linkpkg $(BLINKFLAGS) $^
src/trywhy3/%.cmo: src/trywhy3/%.ml src/trywhy3/%.cmo: src/trywhy3/%.ml
......
...@@ -5,12 +5,9 @@ ...@@ -5,12 +5,9 @@
*) *)
let get_opt o = let get_opt o = Js.Opt.get o (fun () -> assert false)
Js.Opt.get o (fun () -> assert false)
let log s =
Firebug.console ## log (Js.string s)
let log s = Firebug.console ## log (Js.string s)
(* (*
...@@ -86,9 +83,14 @@ let run_alt_ergo_on_task t = ...@@ -86,9 +83,14 @@ let run_alt_ergo_on_task t =
(* printing the task in a string *) (* printing the task in a string *)
Driver.print_task alt_ergo_driver str_formatter t; Driver.print_task alt_ergo_driver str_formatter t;
let text = flush_str_formatter () in let text = flush_str_formatter () in
(* TODO ! *) let lb = Lexing.from_string text in
(* from Alt-Ergo: (* from Alt-Ergo *)
(* does not work yet: it requires zarith
--> investigate how to compile alt-ergo with nums instead
let a = Why_parser.file Why_lexer.token lb in let a = Why_parser.file Why_lexer.token lb in
*)
(* TODO ! *)
(*
let ltd, typ_env = Why_typing.file false Why_typing.empty_env a in let ltd, typ_env = Why_typing.file false Why_typing.empty_env a in
let declss = Why_typing.split_goals ltd in let declss = Why_typing.split_goals ltd in
SAT.start (); SAT.start ();
...@@ -173,7 +175,7 @@ let why3_execute (modules,_theories) = ...@@ -173,7 +175,7 @@ let why3_execute (modules,_theories) =
[moduleans; [moduleans;
Html.ul Html.ul
[[Html.of_string [[Html.of_string
(Pp.sprintf "%a" (Pp.sprintf "Execution of main () returns:@\n%a"
(Mlw_interp.eval_global_symbol env m) d)]]] (Mlw_interp.eval_global_symbol env m) d)]]]
with e -> with e ->
[moduleans; [moduleans;
......
...@@ -19,7 +19,7 @@ let rev_split c s = ...@@ -19,7 +19,7 @@ let rev_split c s =
let rec aux acc i = let rec aux acc i =
try try
let j = String.index_from s i c in let j = String.index_from s i c in
aux ((String.sub s i (j-i))::acc) (j + 1) aux (String.sub s i (j-i) :: acc) (j + 1)
with Not_found -> (String.sub s i (String.length s - i))::acc with Not_found -> (String.sub s i (String.length s - i))::acc
| Invalid_argument _ -> ""::acc in | Invalid_argument _ -> ""::acc in
aux [] 0 aux [] 0
...@@ -28,12 +28,12 @@ let split c s = List.rev (rev_split c s) ...@@ -28,12 +28,12 @@ let split c s = List.rev (rev_split c s)
let rev_bounded_split c s n = let rev_bounded_split c s n =
let rec aux acc i n = let rec aux acc i n =
let get_rest_of_s = (String.sub s i (String.length s - i)) in let get_rest_of_s i = (String.sub s i (String.length s - i)) in
if n = 1 then get_rest_of_s::acc else if n = 1 then get_rest_of_s i :: acc else
try try
let j = String.index_from s i c in let j = String.index_from s i c in
aux ((String.sub s i (j-i))::acc) (j+1) (n-1) aux (String.sub s i (j-i) :: acc) (j+1) (n-1)
with Not_found -> get_rest_of_s::acc with Not_found -> get_rest_of_s i :: acc
| Invalid_argument _ -> ""::acc in | Invalid_argument _ -> ""::acc in
aux [] 0 n aux [] 0 n
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment