Skip to content

Commit 3dec0b8

Browse files
committed
Tracing for OCaml
1 parent 0dfb7d5 commit 3dec0b8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

ML/Checker.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,11 @@ let check_and_verify2 p m ignore_k max_steps inv trans prog query bounds pred s
352352
in let t = Sys.time() -. t
353353
in let _ = println("Internal time for precondition check + actual checking: " ^ string_of_float t)
354354
and _ = println("")
355-
(* and _ = if !debug_level >= 1 then
355+
and _ = if !debug_level >= 1 then
356356
let
357357
_ = println("# explored states: " ^ string_of_int(Tracing.get_count ()))
358358
and _ = println("")
359-
in () else (); *)
359+
in () else ();
360360
in
361361
print_result result
362362

library/Tracing.thy

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,25 @@ end = struct
1717
fun count_up () = (counter := !counter + 1);
1818
fun get_count () = !counter;
1919
end
20+
\<close> and (OCaml)
21+
\<open>
22+
module Tracing : sig
23+
val count_up : unit -> unit
24+
val get_count : unit -> int
25+
end = struct
26+
let counter = ref 0
27+
let count_up () = (counter := !counter + 1)
28+
let get_count () = !counter
29+
end
2030
\<close>
2131

2232
code_reserved SML Tracing
2333

34+
code_reserved OCaml Tracing
35+
2436
code_printing
2537
constant write_msg \<rightharpoonup> (SML) "(fn x => Tracing.count'_up ()) _"
38+
and (OCaml) "(fun x -> Tracing.count'_up ()) _"
2639

2740
definition trace where
2841
"trace m x = (let a = write_msg m in x)"

0 commit comments

Comments
 (0)