#ifndef _LR1ANALYSER_H_INCLUDED_
#define _LR1ANALYSER_H_INCLUDED_
///////////////////////////////////////////////////////////////////////////////
//                                                         
// LR1Analyser.h
// -------------
// dragon LR1 parse table analyser interface defintion
//                                                         
// Design and Implementation by Bjoern Lemke
//
// (C)opyright 2007 by Bjoern Lemke
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; see the file COPYING.  If not, write to
// the Free Software Foundation, 59 Temple Place - Suite 330,
// Boston, MA 02111-1307, USA.
//
// INTERFACE MODULE
//
// Class: LR0Hash
// 
// Description: 
//
///////////////////////////////////////////////////////////////////////////////

#include <lfc/SetT.h>
#include <lfc/Chain.h>

#include "Terminal.h"
#include "Production.h"
#include "FirstHash.h"
#include "LR1Hash.h"
#include "LR1Trans.h"
#include "ClosureCache.h"
#include "LR0Element.h"

class LR1Analyser {
public:
    
    LR1Analyser(SetT<Terminal>* pTerminalSet, SetT<Production> *pProductionSet,
		SetT<FirstHash>* pFirstHashSet);

    ~LR1Analyser();
    
    int analyse(SetT<LR1Hash>& LR1HashSet, SetT<LR1Trans>& LR1TransSet);    
        
private:

    void getSymbolSet(SetT<Chain>& symbolSet);
    void getStartElement(LR1Element& e);
    void getClosure(SetT<LR1Element>& t, const LR1Element& e);
    bool getJump(SetT<LR1Element>& t, SetT<LR1Element>& s, const Chain& symbol);

    
    SetT<Terminal>* _pTerminalSet;
    SetT<Production>* _pProductionSet;
    const SetT<FirstHash>* _pFirstHashSet;

    SetT<ClosureCache> _closureCacheSet;    
};

#endif





