Archon::Utilities::LrParserBase Class Reference

An abstract base class for LR parsers. More...

#include <archon/util/lr_parser_base.H>

Inheritance diagram for Archon::Utilities::LrParserBase:

Inheritance graph
[legend]
Collaboration diagram for Archon::Utilities::LrParserBase:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual ~LrParserBase ()
void parse (LexerBase &lexer, Logger *l=0) const
 Use this method if you want to do syntax checking only.
void parse (LexerBase &lexer, Context &c, Logger *l=0) const
 Use this method if your result becomes available through the context object.
template<class R>
void parse (LexerBase &lexer, Context &c, Ref< const R > &result, Logger *l=0)
 Use this method if your result is the value of the start symbol of the grammar.

Protected Member Functions

 LrParserBase (CFG &, const ActorBase *, const Printer *)
virtual int getAction (int state, int terminal) const =0
 The end of input (EOI) is represented by a terminal value of -1.
virtual int getGoto (int state, int nonterminal) const =0
 Returns: i > -1 => goto state i i <= -1 => error.

Protected Attributes

CFG grammar
vector< Productionproductions

Classes

class  Actor
struct  ActorBase
struct  AttributeTypeException
struct  CallException
 For internal use only. More...
struct  Context
struct  Printer
struct  Production

Detailed Description

An abstract base class for LR parsers.

Todo:
Considder including "lr_parser_methods.H" in this file.
It is not obvious to the user when it has to be included.

Definition at line 86 of file lr_parser_base.H.


Member Function Documentation

virtual int Archon::Utilities::LrParserBase::getAction int  state,
int  terminal
const [protected, pure virtual]
 

The end of input (EOI) is represented by a terminal value of -1.

Actions are represented by one integer where: i > -1 => shift and goto state i i = -1 => error i = -2 => accept i < -2 => reduce by production -3-i

template<class R>
void Archon::Utilities::LrParserBase::parse LexerBase lexer,
Context c,
Ref< const R > &  result,
Logger l = 0
[inline]
 

Use this method if your result is the value of the start symbol of the grammar.

Todo:
Parser errors must be handled properly.

Definition at line 306 of file lr_parser_base.H.

References Archon::Utilities::Ref< T >::get().


The documentation for this class was generated from the following files:
Generated on Sun Jul 30 22:57:34 2006 for Archon by  doxygen 1.4.4