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
# trywhy3
#########
ALTERGODIR=src/trywhy3/alt-ergo-0.99.1
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
js_of_ocaml --extern-fs -I . -I src/trywhy3 --file=trywhy3.conf:/ \
......@@ -1438,7 +1445,7 @@ src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte
`find theories modules \( -name "*.mlw" -o -name "*.why" \) -printf " --file=%p:/"` \
+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) $^
src/trywhy3/%.cmo: src/trywhy3/%.ml
......
......@@ -5,12 +5,9 @@
*)
let get_opt o =
Js.Opt.get o (fun () -> assert false)
let log s =
Firebug.console ## log (Js.string s)
let get_opt o = Js.Opt.get o (fun () -> assert false)
let log s = Firebug.console ## log (Js.string s)
(*
......@@ -86,9 +83,14 @@ let run_alt_ergo_on_task t =
(* printing the task in a string *)
Driver.print_task alt_ergo_driver str_formatter t;
let text = flush_str_formatter () in
(* TODO ! *)
(* from Alt-Ergo:
let lb = Lexing.from_string text in
(* 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
*)
(* TODO ! *)
(*
let ltd, typ_env = Why_typing.file false Why_typing.empty_env a in
let declss = Why_typing.split_goals ltd in
SAT.start ();
......@@ -173,7 +175,7 @@ let why3_execute (modules,_theories) =
[moduleans;
Html.ul
[[Html.of_string
(Pp.sprintf "%a"
(Pp.sprintf "Execution of main () returns:@\n%a"
(Mlw_interp.eval_global_symbol env m) d)]]]
with e ->
[moduleans;
......
......@@ -19,7 +19,7 @@ let rev_split c s =
let rec aux acc i =
try
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
| Invalid_argument _ -> ""::acc in
aux [] 0
......@@ -28,12 +28,12 @@ let split c s = List.rev (rev_split c s)
let rev_bounded_split c s n =
let rec aux acc i n =
let get_rest_of_s = (String.sub s i (String.length s - i)) in
if n = 1 then get_rest_of_s::acc else
let get_rest_of_s i = (String.sub s i (String.length s - i)) in
if n = 1 then get_rest_of_s i :: acc else
try
let j = String.index_from s i c in
aux ((String.sub s i (j-i))::acc) (j+1) (n-1)
with Not_found -> get_rest_of_s::acc
aux (String.sub s i (j-i) :: acc) (j+1) (n-1)
with Not_found -> get_rest_of_s i :: acc
| Invalid_argument _ -> ""::acc in
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