(***********************************************************************)
(*                                                                     *)
(*                                 GALAX                               *)
(*                              XQuery Engine                          *)
(*                                                                     *)
(*  Copyright 2001-2003, Lucent Technologies.                          *)
(*  Distributed only by permission.                                    *)
(*                                                                     *)
(***********************************************************************)

(* $Id: rewrite_walker.mli,v 1.2 2003/05/28 14:47:38 simeon Exp $ *)

(* Module Rewrite_walker
   Description:
     This module implements the generic tree walker, recursive
     application of optimization rules, and fix-point.
*)

(* Type for the rewriting rules *)

type rule =
    Static_context.static_context -> Xquery_ast.cexpr -> Xquery_ast.cexpr * bool

(* Exception raised if a given rewriting rule does not apply *)

exception Not_applied

(* General application of rewriting rules on an XQuery Core AST *)

val generic_tree_apply   :
    Static_context.static_context -> rule list -> Xquery_ast.cexpr -> (Xquery_ast.cexpr * bool)
val children_tree_apply  :
    Static_context.static_context -> rule list -> Xquery_ast.cexpr -> (Xquery_ast.cexpr * bool)
val fix_point_tree_apply :
    Static_context.static_context -> rule list -> Xquery_ast.cexpr -> Xquery_ast.cexpr

