2 #ifndef __PATTERNMATCHER__
3 #define __PATTERNMATCHER__
11 /* Create a pattern matching automaton from the given list of rules. */
13 Automaton *make_pattern_matcher(Tree R);
15 /* Apply the pattern matcher to a single argument, starting from a given state
16 s. Returns the resulting state, modifies the variable bindings E
17 accordingly, and sets C to the resulting closure if a final state is
18 reached. Result will be -1 to indicate a matching failure, and C will be
19 set to nil if no final state has been reached yet. */
21 int apply_pattern_matcher(Automaton *A, // automaton
23 Tree X, // arg to be matched
24 Tree& C, // output closure (if any)
25 vector<Tree>& E); // modified output environments