type env = expr Env.t
and pattern =
| PTactic of loc * id * substs list
- | PVar of loc * id
and expr =
| EGoal of loc * goal
| ECall of loc * id * expr list
and string_pattern () = function
| PTactic (loc, name, params) ->
sprintf "*%s (%s)" name (String.concat ", "
- (List.map (string_substs ()) params));
- | PVar (loc, id) -> id
+ (List.map (string_substs ()) params))
and print_pattern fp p = output_string fp (string_pattern () p)
and pattern =
(** match tactic such as *file ("filename") *)
| PTactic of loc * id * substs list
- (** match named variable, which must be a string, ETactic or
- a list of those *)
- | PVar of loc * id
and expr =
(** goal (params) = patterns : exprs = code *)
| EGoal of loc * goal
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
assert (List.length targs = 1);
let targ = List.hd targs in
not (Sys.file_exists targ)
- | Ast.PVar _ -> assert false (* XXX not implemented *)
(* Find the goal which matches the given tactic and run it.
* cargs is a list of parameters (all constants).
*)
and matching_pattern env loc tactic cargs pattern params =
match pattern with
- | Ast.PVar (loc, name) -> assert false (* TODO! *)
| Ast.PTactic (loc, ttactic, targs)
when tactic <> ttactic ||
List.length cargs <> List.length targs ->
pattern:
| STRING { Ast.PTactic ($loc, "file", [$1]) }
| ID pattern_params { Ast.PTactic ($loc, $1, $2) }
- | ID { Ast.PVar ($loc, $1) }
;
pattern_params:
| LEFT_PAREN separated_list(COMMA, pattern_param) RIGHT_PAREN { $2 }