Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
Automaton Class Reference

#include <lalr.h>

+ Collaboration diagram for Automaton:

Public Types

typedef Node< ReadReadsGraph
 
typedef ReadsGraph::iterator ReadNode
 
typedef Node< IncludeIncludesGraph
 
typedef IncludesGraph::iterator IncludeNode
 

Public Member Functions

 Automaton (Grammar *g)
 
std::pair< StatePointer, bool > internState (const State &state)
 
void build ()
 
void buildNullables ()
 
void buildLookbackSets ()
 
void buildDirectReads ()
 
void buildReadsDigraph ()
 
void buildReads ()
 
void visitReadNode (ReadNode node)
 
void buildIncludesAndFollows ()
 
void buildIncludesDigraph ()
 
void visitIncludeNode (IncludeNode node)
 
void buildLookaheads ()
 
void buildDefaultReduceActions ()
 
void closure (StatePointer state)
 
int id (RulePointer rule)
 
int id (StatePointer state)
 
int id (Name name)
 
void dump (QTextStream &out, IncludeNode incl)
 
void dump (QTextStream &out, ReadNode rd)
 
void dump (QTextStream &out, const Lookback &lp)
 

Public Attributes

Grammar_M_grammar
 
StateList states
 
StatePointer start
 
NameSet nullables
 
QMultiMap< ItemPointer, Lookbacklookbacks
 
QMap< ItemPointer, NameSetlookaheads
 

Detailed Description

Definition at line 309 of file lalr.h.

Member Typedef Documentation

◆ IncludeNode

Definition at line 320 of file lalr.h.

◆ IncludesGraph

Definition at line 319 of file lalr.h.

◆ ReadNode

Definition at line 317 of file lalr.h.

◆ ReadsGraph

Definition at line 316 of file lalr.h.

Constructor & Destructor Documentation

◆ Automaton()

Automaton::Automaton ( Grammar * g)

Definition at line 236 of file lalr.cpp.

Member Function Documentation

◆ build()

void Automaton::build ( )

Definition at line 257 of file lalr.cpp.

References _M_grammar, buildDefaultReduceActions(), buildIncludesAndFollows(), buildLookaheads(), buildLookbackSets(), buildNullables(), buildReads(), closure(), Grammar::goal, State::insert(), internState(), and item.

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildDefaultReduceActions()

void Automaton::buildDefaultReduceActions ( )

Definition at line 724 of file lalr.cpp.

References QMap< Key, T >::end(), item, lookaheads, Q_ASSERT, QMap< Key, T >::size(), state, and QMap< Key, T >::value().

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildDirectReads()

void Automaton::buildDirectReads ( )

Definition at line 445 of file lalr.cpp.

References _M_grammar, Qt::endl(), Grammar::isNonTerminal(), Grammar::isTerminal(), and qerr().

Referenced by buildReads().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildIncludesAndFollows()

void Automaton::buildIncludesAndFollows ( )

Definition at line 565 of file lalr.cpp.

References Node< _Tp >::begin_nodes(), buildIncludesDigraph(), Node< _Tp >::end_nodes(), and visitIncludeNode().

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildIncludesDigraph()

void Automaton::buildIncludesDigraph ( )

Definition at line 586 of file lalr.cpp.

References _M_grammar, A, dot(), Qt::endl(), Node< _Tp >::get(), Grammar::isNonTerminal(), it, qerr(), rule, and Grammar::rule_map.

Referenced by buildIncludesAndFollows().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLookaheads()

void Automaton::buildLookaheads ( )

Definition at line 693 of file lalr.cpp.

References dump(), Qt::endl(), QMap< Key, T >::insert(), it, item, lookaheads, lookbacks, and qerr().

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildLookbackSets()

void Automaton::buildLookbackSets ( )

Definition at line 391 of file lalr.cpp.

References _M_grammar, A, dot(), Qt::endl(), QMultiMap< Key, T >::insert(), Grammar::isNonTerminal(), it, item, lookbacks, Q_ASSERT, qerr(), rule, and Grammar::rule_map.

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildNullables()

void Automaton::buildNullables ( )

Definition at line 277 of file lalr.cpp.

References _M_grammar, Qt::endl(), nullables, qerr(), rule, and Grammar::rules.

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildReads()

void Automaton::buildReads ( )

Definition at line 509 of file lalr.cpp.

References Node< _Tp >::begin_nodes(), buildDirectReads(), buildReadsDigraph(), Node< _Tp >::end_nodes(), and visitReadNode().

Referenced by build().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildReadsDigraph()

void Automaton::buildReadsDigraph ( )

Definition at line 474 of file lalr.cpp.

References _M_grammar, dump(), Qt::endl(), Node< _Tp >::get(), Grammar::isNonTerminal(), nullables, and qerr().

Referenced by buildReads().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ closure()

void Automaton::closure ( StatePointer state)

Definition at line 327 of file lalr.cpp.

References _M_grammar, closure(), internState(), Grammar::isNonTerminal(), it, item, rule, Item::rule, Grammar::rule_map, and state.

Referenced by build(), and closure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump() [1/3]

void Automaton::dump ( QTextStream & out,
const Lookback & lp )

Definition at line 762 of file lalr.cpp.

References Lookback::nt, out, and Lookback::state.

◆ dump() [2/3]

void Automaton::dump ( QTextStream & out,
IncludeNode incl )

Definition at line 752 of file lalr.cpp.

References out.

Referenced by buildLookaheads(), buildReadsDigraph(), and visitIncludeNode().

+ Here is the caller graph for this function:

◆ dump() [3/3]

void Automaton::dump ( QTextStream & out,
ReadNode rd )

◆ id() [1/3]

int Automaton::id ( Name name)

Definition at line 247 of file lalr.cpp.

References _M_grammar, and Grammar::names.

◆ id() [2/3]

int Automaton::id ( RulePointer rule)

Definition at line 242 of file lalr.cpp.

References _M_grammar, rule, and Grammar::rules.

Referenced by CppGenerator::operator()(), DotGraph::operator()(), and ParseTable::operator()().

+ Here is the caller graph for this function:

◆ id() [3/3]

int Automaton::id ( StatePointer state)

Definition at line 252 of file lalr.cpp.

References state.

◆ internState()

std::pair< StatePointer, bool > Automaton::internState ( const State & state)

Definition at line 299 of file lalr.cpp.

References QSet< T >::end(), QSet< T >::insert(), it, and state.

Referenced by build(), and closure().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ visitIncludeNode()

void Automaton::visitIncludeNode ( IncludeNode node)

Definition at line 647 of file lalr.cpp.

References dump(), Qt::endl(), QStack< T >::pop(), QStack< T >::push(), qerr(), qMin(), QStack< T >::top(), and visitIncludeNode().

Referenced by buildIncludesAndFollows(), and visitIncludeNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ visitReadNode()

void Automaton::visitReadNode ( ReadNode node)

Definition at line 528 of file lalr.cpp.

References QStack< T >::pop(), QStack< T >::push(), qMin(), QStack< T >::top(), and visitReadNode().

Referenced by buildReads(), and visitReadNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ _M_grammar

◆ lookaheads

QMap<ItemPointer, NameSet> Automaton::lookaheads

◆ lookbacks

QMultiMap<ItemPointer, Lookback> Automaton::lookbacks

Definition at line 355 of file lalr.h.

Referenced by buildLookaheads(), and buildLookbackSets().

◆ nullables

NameSet Automaton::nullables

Definition at line 354 of file lalr.h.

Referenced by buildNullables(), buildReadsDigraph(), and NotNullable::operator()().

◆ start

StatePointer Automaton::start

Definition at line 353 of file lalr.h.

◆ states

StateList Automaton::states

Definition at line 352 of file lalr.h.

Referenced by CppGenerator::operator()(), DotGraph::operator()(), and ParseTable::operator()().


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