1 //////////////////////////////////////////////////////////////////////////////
4 // ADLib, Prop and their related set of tools and documentation are in the
5 // public domain. The author(s) of this software reserve no copyrights on
6 // the source code and any code generated using the tools. You are encouraged
7 // to use ADLib and Prop to develop software, in both academic and commercial
8 // settings, and are free to incorporate any part of ADLib and Prop into
11 // Although you are under no obligation to do so, we strongly recommend that
12 // you give away all software developed using our tools.
14 // We also ask that credit be given to us when ADLib and/or Prop are used in
15 // your programs, and that this notice be preserved intact in all the source
18 // This software is still under development and we welcome any suggestions
19 // and help from the users.
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef term_patterns_h
26 #define term_patterns_h
28 #include <AD/generic/generic.h> // Generic definitions
30 typedef class a_TermPat
* TermPat
;
33 a_Term(const a_TermPat
&); // no copy constructor
34 void operator = (const a_TermPat
&); // no assignment
38 typedef short Symbol
; // Functor or variable is a symbol
39 typedef short Functor
; // A functor (i.e. constructor)
40 typedef unsigned char Arity
; // Arity of a functor
44 TermPat subterms
[1]; // array of subterms, if any
49 a_TermPat (Functor g
, Arity k
= 0) : f(g
), n(k
) {}
51 Functor
tag() const { return f
; }
52 int arity() const { return n
; }
53 TermPat
nth(int i
) { return subterms
[i
]; }
54 friend Bool
isWild(const TermPat p
) { return p
== 0; }