Commit 38a30582 authored by MARCHE Claude's avatar MARCHE Claude
Browse files

try Why3: using specific file names for the config file and the alt-ergo driver

parent d1f5eae2
...@@ -1430,8 +1430,8 @@ JSOCAMLC=ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.syntax \ ...@@ -1430,8 +1430,8 @@ JSOCAMLC=ocamlfind ocamlc -package js_of_ocaml -package js_of_ocaml.syntax \
-syntax camlp4o -I src/trywhy3 -syntax camlp4o -I src/trywhy3
src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte src/trywhy3/trywhy3.js: src/trywhy3/trywhy3.byte
js_of_ocaml --extern-fs -I src/trywhy3 -I . --file=why3.conf:/ \ js_of_ocaml --extern-fs -I . -I src/trywhy3 --file=trywhy3.conf:/ \
--file=alt_ergo.drv:/ \ --file=try_alt_ergo.drv:/ \
--file=drinkers.why:/ \ --file=drinkers.why:/ \
--file=simplearith.why:/ \ --file=simplearith.why:/ \
--file=isqrt.mlw:/ \ --file=isqrt.mlw:/ \
......
(* Driver for Alt-Ergo version >= 0.95 *) (* Driver for Alt-Ergo, specific variant for Try Why3 *)
(* FIXME: it would be better to share the common parts with the regular
Alt-Ergo driver *)
prelude "(* this is the prelude for Alt-Ergo, any versions *)" prelude "(* this is the prelude for Alt-Ergo, version for Try Why3 *)"
printer "alt-ergo" printer "alt-ergo"
filename "%f-%t-%g.why" filename "%f-%t-%g.why"
(* Try Why3 doesn't need these
valid "Valid" valid "Valid"
invalid "Invalid" invalid "Invalid"
unknown "I don't know" "" unknown "I don't know" ""
...@@ -13,17 +16,11 @@ steplimitexceeded "Steps limit reached" ...@@ -13,17 +16,11 @@ steplimitexceeded "Steps limit reached"
outofmemory "Fatal error: out of memory" outofmemory "Fatal error: out of memory"
outofmemory "Fatal error: exception Stack_overflow" outofmemory "Fatal error: exception Stack_overflow"
fail "typing error:\\(.*\\)$" "Failure : File generation error : \\1" fail "typing error:\\(.*\\)$" "Failure : File generation error : \\1"
(*
time "Valid (%s)"
time "Valid (%s)"
steps "Valid (\\([0-9]+.?[0-9]*\\)) (\\([0-9]+.?[0-9]*\\))" 2
steps "Valid (\\([0-9]+.?[0-9]*\\)) (\\([0-9]+.?[0-9]*\\) steps)" 2
time "why3cpulimit time : %s s"
*) *)
(* À discuter *) (* FIXME: remaining of this file should be shared with regular Alt-Ergo driver *)
transformation "inline_trivial"
transformation "inline_trivial"
transformation "eliminate_builtin" transformation "eliminate_builtin"
transformation "eliminate_recursion" transformation "eliminate_recursion"
transformation "eliminate_inductive" transformation "eliminate_inductive"
...@@ -31,7 +28,6 @@ transformation "eliminate_algebraic" ...@@ -31,7 +28,6 @@ transformation "eliminate_algebraic"
transformation "eliminate_epsilon" transformation "eliminate_epsilon"
transformation "eliminate_if" transformation "eliminate_if"
transformation "eliminate_let" transformation "eliminate_let"
transformation "split_premise_right" transformation "split_premise_right"
transformation "simplify_formula" transformation "simplify_formula"
(*transformation "simplify_trivial_quantification_in_goal"*) (*transformation "simplify_trivial_quantification_in_goal"*)
......
...@@ -10,7 +10,7 @@ timelimit = 5 ...@@ -10,7 +10,7 @@ timelimit = 5
[prover] [prover]
command = "%l/why3-cpulimit %T %m -s alt-ergo-0.99.1 -timelimit %t %f" command = "%l/why3-cpulimit %T %m -s alt-ergo-0.99.1 -timelimit %t %f"
command_steps = "%l/why3-cpulimit %U %m -s alt-ergo-0.99.1 -steps-bound %S %f" command_steps = "%l/why3-cpulimit %U %m -s alt-ergo-0.99.1 -steps-bound %S %f"
driver = "/alt_ergo.drv" driver = "/try_alt_ergo.drv"
editor = "altgr-ergo" editor = "altgr-ergo"
in_place = false in_place = false
interactive = false interactive = false
......
(*
small helpers
*)
let get_opt o =
Js.Opt.get o (fun () -> assert false)
let log s =
Firebug.console ## log (Js.string s)
(* (*
module for generating HTML elements module for generating HTML elements
...@@ -30,17 +43,13 @@ let ul nl = ...@@ -30,17 +43,13 @@ let ul nl =
end end
let get_opt o = (*
Js.Opt.get o (fun () -> assert false)
let log s = Interface to Why3 and Alt-Ergo
Firebug.console ## log (Js.string s)
let temp_file_name = "/input.mlw" *)
let why3_conf_file = "/why3.conf"
let () = let why3_conf_file = "/trywhy3.conf"
Sys_js.register_file ~name:temp_file_name ~content:""
open Why3 open Why3
open Format open Format
...@@ -63,7 +72,6 @@ let alt_ergo : Whyconf.config_prover = ...@@ -63,7 +72,6 @@ let alt_ergo : Whyconf.config_prover =
(* builds the environment from the [loadpath] *) (* builds the environment from the [loadpath] *)
let env : Env.env = Env.create_env (Whyconf.loadpath main) let env : Env.env = Env.create_env (Whyconf.loadpath main)
let alt_ergo_driver : Driver.driver = let alt_ergo_driver : Driver.driver =
try try
Printexc.record_backtrace true; Printexc.record_backtrace true;
...@@ -74,7 +82,6 @@ let alt_ergo_driver : Driver.driver = ...@@ -74,7 +82,6 @@ let alt_ergo_driver : Driver.driver =
Exn_printer.exn_printer e s; Exn_printer.exn_printer e s;
exit 1 exit 1
let run_alt_ergo_on_task t = 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;
...@@ -181,6 +188,18 @@ let why3_execute (modules,_theories) = ...@@ -181,6 +188,18 @@ let why3_execute (modules,_theories) =
*) *)
(*
Connecting why3 calls to the interface
*)
let temp_file_name = "/input.mlw"
let () =
Sys_js.register_file ~name:temp_file_name ~content:""
let run_why3 f lang global text = let run_why3 f lang global text =
let ch = open_out temp_file_name in let ch = open_out temp_file_name in
output_string ch text; output_string ch text;
...@@ -190,13 +209,6 @@ let run_why3 f lang global text = ...@@ -190,13 +209,6 @@ let run_why3 f lang global text =
let theories = Env.read_file lang env temp_file_name in let theories = Env.read_file lang env temp_file_name in
f theories f theories
with with
(*
| Loc.Located(loc,Parser.Error) ->
let (_,l,b,e) = Loc.get loc in
Html.par
[Html.of_string
(Pp.sprintf "syntax error line %d, columns %d-%d" l b e)]
*)
| Loc.Located(loc,e') -> | Loc.Located(loc,e') ->
let (_,l,b,e) = Loc.get loc in let (_,l,b,e) = Loc.get loc in
ignore (Js.Unsafe.meth_call global "highlightError" ignore (Js.Unsafe.meth_call global "highlightError"
...@@ -240,6 +252,13 @@ let () = ...@@ -240,6 +252,13 @@ let () =
add_why3_cmd "prove" why3_prove Env.base_language; add_why3_cmd "prove" why3_prove Env.base_language;
add_why3_cmd "run" why3_execute Mlw_module.mlw_language add_why3_cmd "run" why3_execute Mlw_module.mlw_language
(*
Predefined examples
*)
let add_file_example buttonname file = let add_file_example buttonname file =
let handler = Dom.handler let handler = Dom.handler
(fun _ev -> (fun _ev ->
......
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