006d55a77ae91bd521853a6a44ec1e3b49f45b61
[Faustine.git] / interpretor / faust-0.9.47mr3 / compiler / patternmatcher / patternmatcher.hh
1
2 #ifndef __PATTERNMATCHER__
3 #define __PATTERNMATCHER__
4
5 using namespace std;
6 #include <vector>
7 #include "tlib.hh"
8
9 struct Automaton;
10
11 /* Create a pattern matching automaton from the given list of rules. */
12
13 Automaton *make_pattern_matcher(Tree R);
14
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. */
20
21 int apply_pattern_matcher(Automaton *A, // automaton
22 int s, // start state
23 Tree X, // arg to be matched
24 Tree& C, // output closure (if any)
25 vector<Tree>& E); // modified output environments
26
27 #endif