diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lem_interp/printing_functions.ml | 5 | ||||
| -rw-r--r-- | src/lem_interp/printing_functions.mli | 39 |
2 files changed, 35 insertions, 9 deletions
diff --git a/src/lem_interp/printing_functions.ml b/src/lem_interp/printing_functions.ml index 4cc02074..80089f85 100644 --- a/src/lem_interp/printing_functions.ml +++ b/src/lem_interp/printing_functions.ml @@ -192,5 +192,10 @@ let get_loc (E_aux(_, (l, (_ : tannot)))) = loc_to_string l let print_exp printer e = printer ((get_loc e) ^ ": " ^ (Pretty_interp.pp_exp e) ^ "\n") +let instruction_state_to_string stack = + List.fold_right (fun e es -> (exp_to_string e) ^ "\n" ^ es) (compact_stack stack) "" + +let top_instruction_state_to_string stack = exp_to_string (top_frame_exp stack) + let print_backtrace_compact printer stack = List.iter (print_exp printer) (compact_stack stack) let print_continuation printer stack = print_exp printer (top_frame_exp stack) diff --git a/src/lem_interp/printing_functions.mli b/src/lem_interp/printing_functions.mli index 24c80359..da9347ef 100644 --- a/src/lem_interp/printing_functions.mli +++ b/src/lem_interp/printing_functions.mli @@ -2,23 +2,44 @@ open Interp_utilities;; open Interp_ast ;; open Interp_interface ;; +(*Functions to translate values, registers, or locations strings *) +(*Takes a location to a formatted string*) val loc_to_string : l -> string -val top_frame_exp : instruction_state -> tannot exp +(*Returns the result of above for the exp's location *) val get_loc : tannot exp -> string -val compact_exp : tannot exp -> tannot exp +(*interp_interface.value to string*) val val_to_string : value0 -> string -val dependencies_to_string : reg_name list -> string +(* format one register *) val reg_name_to_string : reg_name -> string - -val format_events : event list -> string - +(* format the register dependencies *) +val dependencies_to_string : reg_name list -> string +(* formats an expression, using interp_pretty *) val exp_to_string : tannot exp -> string -val print_exp : (string-> unit) -> tannot exp -> unit -val print_backtrace_compact : (string -> unit) -> instruction_state -> unit -val print_continuation : (string -> unit) -> instruction_state -> unit +(* Functions to set the color of parts of the output *) val red : string -> string val blue : string -> string val green : string -> string val yellow : string -> string val grey : string -> string + + +(*Functions to modify the instruction state and expression used in printing and in run_model*) +val compact_exp : tannot exp -> tannot exp +val top_frame_exp : instruction_state -> tannot exp + + +(*functions to format events and instruction_states to strings *) +(*Create one large string of all of the events (indents automatically) *) +val format_events : event list -> string +(*format a portion of the instruction state for easy viewing *) +val instruction_state_to_string : instruction_state -> string +(*format just the top of the call stack*) +val top_instruction_state_to_string : instruction_state -> string + + +(*Functions to take a print function and cause a print event for the above functions *) +val print_exp : (string-> unit) -> tannot exp -> unit +val print_backtrace_compact : (string -> unit) -> instruction_state -> unit +val print_continuation : (string -> unit) -> instruction_state -> unit + |
