summaryrefslogtreecommitdiff
path: root/src/lem_interp/interp_inter_imp.lem
diff options
context:
space:
mode:
Diffstat (limited to 'src/lem_interp/interp_inter_imp.lem')
-rw-r--r--src/lem_interp/interp_inter_imp.lem18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lem_interp/interp_inter_imp.lem b/src/lem_interp/interp_inter_imp.lem
index a69ea430..292552f4 100644
--- a/src/lem_interp/interp_inter_imp.lem
+++ b/src/lem_interp/interp_inter_imp.lem
@@ -91,7 +91,7 @@ let memory_functions =
(v,len,regs) end end)));
]
-let rec interp_to_value_helper thunk =
+let rec interp_to_value_helper arg thunk =
match thunk() with
| Interp.Value value -> (Just value,Nothing)
| Interp.Error l msg -> (Nothing, Just (Internal_error msg))
@@ -99,12 +99,12 @@ let rec interp_to_value_helper thunk =
match List.lookup i external_functions with
| Nothing -> (Nothing, Just (Internal_error ("External function not available " ^ i)))
| Just f ->
- interp_to_value_helper (fun _ -> Interp.resume (make_mode true false) stack (Just (f value)))
+ interp_to_value_helper arg (fun _ -> Interp.resume (make_mode true false) stack (Just (f value)))
end
| Interp.Action (Interp.Exit (E_aux e _)) _ ->
match e with
| E_id (Id_aux (Id "unsupported_instruction") _) -> (Nothing,Just (Unsupported_instruction_error ("",[],[])))
- | E_id (Id_aux (Id "no_matching_pattern") _) -> (Nothing,Just Not_an_instruction_error)
+ | E_id (Id_aux (Id "no_matching_pattern") _) -> (Nothing,Just (Not_an_instruction_error arg))
end
| _ -> (Nothing, Just (Internal_error "Memory or register requested in decode"))
end
@@ -112,7 +112,7 @@ end
let decode_to_istate top_level value =
let mode = make_mode true false in
let (arg,_) = Interp.to_exp mode Interp.eenv (intern_value value) in
- let (instr_decoded,error) = interp_to_value_helper
+ let (instr_decoded,error) = interp_to_value_helper value
(fun _ -> Interp.resume
(make_mode true false)
(Interp.Thunk_frame
@@ -121,7 +121,7 @@ let decode_to_istate top_level value =
match (instr_decoded,error) with
| (Just instr, _) ->
let (arg,_) = Interp.to_exp mode Interp.eenv instr in
- let (instr_decoded,error) = interp_to_value_helper
+ let (instr_decoded,error) = interp_to_value_helper value
(fun _ -> Interp.resume
(make_mode true false)
(Interp.Thunk_frame
@@ -130,13 +130,13 @@ let decode_to_istate top_level value =
match (instr_decoded,error) with
| (Just instr,_) ->
let (arg,_) = Interp.to_exp mode Interp.eenv instr in
- Instr (Interp.Thunk_frame
+ Instr ("",[],[])
+ (Interp.Thunk_frame
(E_aux (E_app (Id_aux (Id "execute") Interp_ast.Unknown) [arg]) (Interp_ast.Unknown,Nothing))
top_level Interp.eenv Interp.emem Interp.Top)
- ("",[],[])
- | (Nothing, Just err) -> err
+ | (Nothing, Just err) -> Decode_error err
end
- | (Nothing, Just err) -> err
+ | (Nothing, Just err) -> Decode_error err
end
let rec interp_to_outcome mode thunk =