Commit 687aa49a authored by Jean-Christophe Filliâtre's avatar Jean-Christophe Filliâtre
Browse files

le binaire why prend maintenant une option -I pour fixer le loadpath ; les...

le binaire why prend maintenant  une option -I pour fixer le loadpath ; les theories les plus primitives dans prelude.why
parent 9007b22c
...@@ -124,7 +124,7 @@ bin/top: $(CMO) ...@@ -124,7 +124,7 @@ bin/top: $(CMO)
ocamlmktop $(BFLAGS) -o $@ $^ ocamlmktop $(BFLAGS) -o $@ $^
test: bin/why.byte test: bin/why.byte
ocamlrun -bt bin/why.byte src/test.why ocamlrun -bt bin/why.byte -I lib/prelude/ src/test.why
# graphical interface # graphical interface
##################### #####################
......
theory List
type 'a list (* additional theories over lists *)
(* type 'a list = Nil | Cons ('a,'a list) *) theory IntList
logic nil : 'a list use prelude.List
logic cons : 'a, 'a list -> 'a list
logic is_nil : 'a list -> prop
type int (* use import Int *)
logic length : 'a list -> int
end end
(* The Why prelude *)
theory Int
type int
end
theory List
(* type 'a list = Nil | Cons ('a, 'a list) *)
type 'a list
logic nil : 'a list
logic cons('a, 'a list) : 'a list
logic is_nil('a list)
end
...@@ -23,12 +23,15 @@ let files = ref [] ...@@ -23,12 +23,15 @@ let files = ref []
let parse_only = ref false let parse_only = ref false
let type_only = ref false let type_only = ref false
let debug = ref false let debug = ref false
let loadpath = ref []
let () = let () =
Arg.parse Arg.parse
["--parse-only", Arg.Set parse_only, "stops after parsing"; ["--parse-only", Arg.Set parse_only, "stops after parsing";
"--type-only", Arg.Set type_only, "stops after type-checking"; "--type-only", Arg.Set type_only, "stops after type-checking";
"--debug", Arg.Set debug, "sets the debug flag"; "--debug", Arg.Set debug, "sets the debug flag";
"-I", Arg.String (fun s -> loadpath := s :: !loadpath),
"<dir> adds dir to the loadpath";
] ]
(fun f -> files := f :: !files) (fun f -> files := f :: !files)
"usage: why [options] files..." "usage: why [options] files..."
...@@ -55,7 +58,7 @@ let type_file env file = ...@@ -55,7 +58,7 @@ let type_file env file =
let () = let () =
try try
let env = Typing.create ["lib"; ""] in let env = Typing.create !loadpath in
ignore (List.fold_left type_file env !files) ignore (List.fold_left type_file env !files)
with e when not !debug -> with e when not !debug ->
eprintf "%a@." report e; eprintf "%a@." report e;
......
(* test file *) (* test file *)
theory A theory TestPrelude
type 'a list use prelude.List
logic nil : 'a list use list.IntList
logic cons('a, 'a list) : 'a list end
theory A
type t type t
logic p('a list) logic p(t)
logic is_nil(x: 'a list) = p(x) logic q(x: t) = p(x)
logic c : t list logic c : t
end end
theory B theory B
use import A use import prelude.List
type t
axiom Ax : forall x : t list. true axiom Ax : forall x : t list. true
end end
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