Empirical
Public Member Functions | List of all members
emp::Parser Class Reference

Full information about a parser, including a lexer, symbols, and rules. More...

#include <Parser.h>

Public Member Functions

 Parser (Lexer &in_lexer)
 
 ~Parser ()
 
LexerGetLexer ()
 
size_t GetID (size_t id) const
 Trivial conversions of ID to ID... More...
 
size_t GetID (const std::string &name)
 Converstion of a symbol name to its ID. More...
 
std::string GetName (size_t symbol_id) const
 Conversion ot a sybol ID to its name. More...
 
Parseroperator() (const std::string &name)
 Provide a symbol to the compiler and set it as active. More...
 
ParseSymbolGetParseSymbol (const std::string &name)
 Get the parser symbol information associated with a provided name. More...
 
template<typename... STATES>
ParserRule (STATES...states)
 Use the currently active symbol and attach a rule to it. More...
 
template<typename... STATES>
size_t AddRule (const std::string &name, STATES &&...states)
 Specify the name of the symbol and add a rule to it, returning the symbol id. More...
 
void Process (std::istream &is, bool test_valid=true)
 Convert an input stream into a parse tree (TO FINISH!) More...
 
void Print (std::ostream &os=std::cout) const
 Print the current status of this parser (for debugging) More...
 

Detailed Description

Full information about a parser, including a lexer, symbols, and rules.

Constructor & Destructor Documentation

emp::Parser::Parser ( Lexer in_lexer)
inline
emp::Parser::~Parser ( )
inline

Member Function Documentation

template<typename... STATES>
size_t emp::Parser::AddRule ( const std::string &  name,
STATES &&...  states 
)
inline

Specify the name of the symbol and add a rule to it, returning the symbol id.

size_t emp::Parser::GetID ( size_t  id) const
inline

Trivial conversions of ID to ID...

size_t emp::Parser::GetID ( const std::string &  name)
inline

Converstion of a symbol name to its ID.

Lexer& emp::Parser::GetLexer ( )
inline
std::string emp::Parser::GetName ( size_t  symbol_id) const
inline

Conversion ot a sybol ID to its name.

ParseSymbol& emp::Parser::GetParseSymbol ( const std::string &  name)
inline

Get the parser symbol information associated with a provided name.

Parser& emp::Parser::operator() ( const std::string &  name)
inline

Provide a symbol to the compiler and set it as active.

void emp::Parser::Print ( std::ostream &  os = std::cout) const
inline

Print the current status of this parser (for debugging)

void emp::Parser::Process ( std::istream &  is,
bool  test_valid = true 
)
inline

Convert an input stream into a parse tree (TO FINISH!)

template<typename... STATES>
Parser& emp::Parser::Rule ( STATES...  states)
inline

Use the currently active symbol and attach a rule to it.


The documentation for this class was generated from the following file: