summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSon Ho2022-02-08 19:18:57 +0100
committerSon Ho2022-02-08 19:18:57 +0100
commitd54b36be3d365b1a9a4ec8b12313b84c508ecd98 (patch)
tree630ce2bc2444af84821364275291c8f0218a3e58
parent2145c29ba8d7727f104da83c6be57bf2f3f408d5 (diff)
Implement pre-passes to update the AST before executing the interpreter
-rw-r--r--src/InterpreterUtils.ml2
-rw-r--r--src/Logging.ml3
-rw-r--r--src/Print.ml2
-rw-r--r--src/main.ml3
4 files changed, 7 insertions, 3 deletions
diff --git a/src/InterpreterUtils.ml b/src/InterpreterUtils.ml
index bbdd038f..0445c6b6 100644
--- a/src/InterpreterUtils.ml
+++ b/src/InterpreterUtils.ml
@@ -1,5 +1,3 @@
-(* TODO: most of the definitions in this file need to be moved elsewhere *)
-
module T = Types
module V = Values
module E = Expressions
diff --git a/src/Logging.ml b/src/Logging.ml
index 5605772d..f4fa9309 100644
--- a/src/Logging.ml
+++ b/src/Logging.ml
@@ -9,6 +9,9 @@ let main_log = L.get_logger "MainLogger"
(** Below, we create subgloggers for various submodules, so that we can precisely
toggle logging on/off, depending on which information we need *)
+(** Logger for PrePasses *)
+let pre_passes_log = L.get_logger "MainLogger.PrePasses"
+
(** Logger for Translate *)
let translate_log = L.get_logger "MainLogger.Translate"
diff --git a/src/Print.ml b/src/Print.ml
index 2db92d41..7c1ef79a 100644
--- a/src/Print.ml
+++ b/src/Print.ml
@@ -733,7 +733,7 @@ module CfimAst = struct
| E.Field (E.ProjOption variant_id, fid) ->
assert (variant_id == T.option_some_id);
assert (fid == T.FieldId.zero);
- "(" ^ s ^ "as Option::Some)." ^ T.FieldId.to_string fid
+ "(" ^ s ^ " as Option::Some)." ^ T.FieldId.to_string fid
| E.Field (E.ProjTuple _, fid) ->
"(" ^ s ^ ")." ^ T.FieldId.to_string fid
| E.Field (E.ProjAdt (adt_id, opt_variant_id), fid) -> (
diff --git a/src/main.ml b/src/main.ml
index 2502ac4d..79a04c4e 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -113,6 +113,9 @@ let () =
(* Print the module *)
main_log#ldebug (lazy ("\n" ^ Print.Module.module_to_string m ^ "\n"));
+ (* Apply the pre-passes *)
+ let m = PrePasses.apply_passes m in
+
(* Some options for the execution *)
let config =
{