+ (* Add some standard variables to the environment. *)
+ let expr_of_substs s = Ast.ESubsts (Ast.noloc, s) in
+ let expr_of_pattern = function
+ | Ast.PTactic (loc, tactic, targs) ->
+ Ast.ETactic (loc, tactic, List.map expr_of_substs targs)
+ | Ast.PVar (loc, name) ->
+ Ast.EVar (loc, name)
+ in
+ let pexprs = List.map expr_of_pattern patterns in
+ let env = Ast.Env.add "@" (Ast.EList (Ast.noloc, pexprs)) env in
+ let env = Ast.Env.add "<" (Ast.EList (Ast.noloc, deps)) env in
+ let env =
+ match deps with
+ | [] -> env
+ | d :: _ -> Ast.Env.add "^" d env in
+ let code = Ast.to_shell_script env loc code in
+ let code = "set -e\nset -x\n\n" ^ code in
+ let r = Sys.command code in
+ if r <> 0 then (
+ eprintf "*** goal ā%sā failed with exit code %d\n" name r;
+ exit 1
+ )