1 #ifndef _LR1ANALYSER_H_INCLUDED_
2 #define _LR1ANALYSER_H_INCLUDED_
3 ///////////////////////////////////////////////////////////////////////////////
4 //
5 // LR1Analyser.h
6 // -------------
7 // dragon LR1 parse table analyser interface defintion
8 //
9 // Design and Implementation by Bjoern Lemke
10 //
11 // (C)opyright 2007 by Bjoern Lemke
12 //
13 // This program is free software; you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation; either version 2, or (at your option)
16 // any later version.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; see the file COPYING.  If not, write to
25 // the Free Software Foundation, 59 Temple Place - Suite 330,
26 // Boston, MA 02111-1307, USA.
27 //
28 // INTERFACE MODULE
29 //
30 // Class: LR0Hash
31 //
32 // Description:
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #include <lfcbase/SetT.h>
37 #include <lfcbase/Chain.h>
38 
39 #include "Terminal.h"
40 #include "Production.h"
41 #include "FirstHash.h"
42 #include "LR1Hash.h"
43 #include "LR1Trans.h"
44 #include "ClosureCache.h"
45 #include "LR0Element.h"
46 
47 class LR1Analyser {
48 public:
49 
50     LR1Analyser(SetT<Terminal>* pTerminalSet, SetT<Production> *pProductionSet,
51 		SetT<FirstHash>* pFirstHashSet);
52 
53     ~LR1Analyser();
54 
55     int analyse(SetT<LR1Hash>& LR1HashSet, SetT<LR1Trans>& LR1TransSet);
56 
57 private:
58 
59     void getSymbolSet(SetT<Chain>& symbolSet);
60     void getStartElement(LR1Element& e);
61     void getClosure(SetT<LR1Element>& t, const LR1Element& e);
62     bool getJump(SetT<LR1Element>& t, SetT<LR1Element>& s, const Chain& symbol);
63 
64 
65     SetT<Terminal>* _pTerminalSet;
66     SetT<Production>* _pProductionSet;
67     const SetT<FirstHash>* _pFirstHashSet;
68 
69     SetT<ClosureCache> _closureCacheSet;
70 };
71 
72 #endif
73 
74 
75 
76 
77 
78