simple.cc - generated code example
[prop.git] / include / AD / rewrite / b_item.h
blob781832c1e6b07cd8683ecd74fe8efae58bba2481
1 //////////////////////////////////////////////////////////////////////////////
2 // NOTICE:
3 //
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 welcomed to incorporate any part of ADLib and Prop into
9 // your programs.
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
16 // code.
18 // This software is still under development and we welcome(read crave for)
19 // any suggestions and help from the users.
21 // Allen Leung
22 // 1994
23 //////////////////////////////////////////////////////////////////////////////
25 #ifndef BURS_item_h
26 #define BURS_item_h
28 #include <iostream>
29 #include <AD/automata/treegram.h> // tree grammar
30 #include <AD/generic/ordering.h> // hashing functions
32 //////////////////////////////////////////////////////////////////////////////
33 // Items used in the bottom up rewrite system (BURS) generator.
34 // An item encodes the following information:
35 // (1) A non-terminal,
36 // (2) The reduction rule used to arrive at this non-terminal, and
37 // (3) The reduction cost.
38 //////////////////////////////////////////////////////////////////////////////
39 class BURS_Item {
40 public:
42 ///////////////////////////////////////////////////////////////////////////
43 // Import some types
44 ///////////////////////////////////////////////////////////////////////////
45 typedef TreeGrammar::State State;
46 typedef TreeGrammar::Functor Functor;
47 typedef TreeGrammar::Arity Arity;
48 typedef TreeGrammar::NonTerminal NonTerminal;
49 typedef TreeGrammar::Cost Cost; // reduction cost
50 typedef TreeGrammar::Rule Rule; // reduction rule
52 public:
54 ///////////////////////////////////////////////////////////////////////////
55 // The internal representation is visible.
56 ///////////////////////////////////////////////////////////////////////////
57 Cost cost; // cost of reduction
58 Rule rule; // reduction rule
60 public:
62 ///////////////////////////////////////////////////////////////////////////
63 // Printing method.
64 ///////////////////////////////////////////////////////////////////////////
65 friend std::ostream& operator << (std::ostream&, const BURS_Item&);
68 #endif