-
Notifications
You must be signed in to change notification settings - Fork 1
/
trace.ml
35 lines (25 loc) · 1.3 KB
/
trace.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
open Ident
open Expr
let traceHole v gma = print_string ("\nHole:\n\n" ^ Expr.showGamma gma ^ "\n" ^ String.make 80 '-' ^ "\n" ^ Expr.showValue v ^ "\n\n")
let trace x = print_string x; flush_all ()
let traceCheck (e : exp) (t : value) : unit = if !Prefs.trace then
trace (Printf.sprintf "CHECK: %s : %s\n" (showExp e) (showValue t))
let traceInfer (e : exp) : unit = if !Prefs.trace then
trace (Printf.sprintf "INFER: %s\n" (showExp e))
let traceInferV (v : value) : unit = if !Prefs.trace then
trace (Printf.sprintf "INFERV: %s\n" (showValue v))
let traceEval (e : exp) : unit = if !Prefs.trace then
trace (Printf.sprintf "EVAL: %s\n" (showExp e))
let traceRbV (v : value) : unit = if !Prefs.trace then
trace (Printf.sprintf "RBV: %s\n" (showValue v))
let traceClos (e : exp) (p : name) (v : value) : unit = if !Prefs.trace then
trace (Printf.sprintf "CLOSBYVAL: (%s)(%s := %s)\n" (showExp e) (showName p) (showValue v))
let traceConv (v1 : value) (v2 : value) : unit = if !Prefs.trace then
trace (Printf.sprintf "CONV: %s = %s\n" (showValue v1) (showValue v2))
let traceEqNF (v1 : value) (v2 : value) : unit = if !Prefs.trace then
trace (Printf.sprintf "EQNF: %s = %s\n" (showValue v1) (showValue v2))
let traceDebug f =
Printf.printf "START\n";
let res = f () in
Printf.printf "END\n";
res