2 (* Copyright (C) 2005, HELM Team.
4 * This file is part of HELM, an Hypertextual, Electronic
5 * Library of Mathematics, developed at the Computer Science
6 * Department, University of Bologna, Italy.
8 * HELM is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
13 * HELM is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with HELM; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston,
23 * For details, see the HELM World-Wide-Web page,
24 * http://helm.cs.unibo.it/
27 type pattern_kind = Variable | Constructor
35 val classify : pattern_t -> pattern_kind
36 val tag_of_pattern : pattern_t -> tag_t * pattern_t list
37 val tag_of_term : term_t -> tag_t * term_t list
40 val string_of_term: term_t -> string
41 val string_of_pattern: pattern_t -> string
44 module Matcher (P: PATTERN) :
46 (** @param patterns pattern matrix (pairs <pattern, pattern_id>)
47 * @param success_cb callback invoked in case of matching.
48 * Its argument are the list of pattern who matches the input term, the list
49 * of terms bound in them, the list of terms which matched constructors.
50 * Its return value is Some _ if the matching is valid, None otherwise; the
51 * latter kind of return value will trigger backtracking in the pattern
53 * @param failure_cb callback invoked in case of matching failure
54 * @param term term on which pattern match on *)
56 (P.pattern_t * int) list ->
57 ((P.pattern_t list * int) list -> P.term_t list -> P.term_t list ->
58 'a option) -> (* terms *) (* constructors *)
59 (unit -> 'a option) ->
60 (P.term_t -> 'a option)