|
Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
|
Deterministic real time height deterministic pushdown automaton. Accepts subset of context free languages. More...
#include <RealTimeHeightDeterministicDPDA.h>
Public Types | |
| typedef InputSymbolTypeT | InputSymbolType |
| typedef PushdownStoreSymbolTypeT | PushdownStoreSymbolType |
| typedef StateTypeT | StateType |
| using | StateType_t = StateType |
| using | PushdownStoreSymbolType_t = PushdownStoreSymbolType |
Friends | |
| ext::ostream & | operator<< (ext::ostream &out, const RealTimeHeightDeterministicDPDA &instance) |
Deterministic real time height deterministic pushdown automaton. Accepts subset of context free languages.
Definition A = (Q, T, G, I, Z, \delta, F), Q (States) = nonempty finite set of states, T (TerminalAlphabet) = finite set of terminal symbols G (PushdownStoreAlphabet) = finite set of pushdown store symbol - having this empty makes the automaton equivalent to DFA I (InitialState) = initial state, Z (BottomOfTheStackSymbol) = initial pushdown store symbol \delta is split to three disjoint parts
The transition functions must meet following criteria. Othervise adding conflicting transition will cause exception. $|\delta_{call} (q, a)| \leq 1$, $\forall q \in Q, a \in T \cup { \eps }$ $|\delta_{return} (q, a, g)| \leq 1$, $\forall q \in Q, a \in T \cup { \eps }, g \in G$ $|\delta_{local} (q, a)| \leq 1$, $\forall q \in Q, a \in T \cup { \eps }$
if $|\delta_{call} (q, \eps)|$ == 1 then $|\delta_{return} (q, a, g)|$ == 0, $|\delta_{local} (q, a)|$ == 0, \forall q \in Q, a \in T \cup { \eps }, and g \in G if $|\delta_{return} (q, \eps, g)|$ == 1 then $|\delta_{call} (q, a)|$ == 0, $|\delta_{return} (q, b, g)|$ == 0, $|\delta_{local} (q, \eps)|$ == 0, \forall q \in Q, a \in T \cup { \eps }, b \in T, and g \in G if $|\delta_{local} (q, \eps)|$ == 1 then $|\delta_{call} (q, a)|$ == 0, $|\delta_{return} (q, a, g)|$ == 0, \forall q \in Q, a \in T \cup { \eps }, and g \in G
if $|\delta_{call} (q, a)|$ == 1 then $|\delta_{call} (q, \eps)|$ == 0, $|\delta_{return} (q, a, g)|$ == 0, $|\delta_{return} (q, \eps, g)|$ == 0, $|\delta_{local} (q, a)|$ == 0, $|\delta_{local} (q, \eps)|$ == 0, \forall q \in Q, a \in T, and g \in G if $|\delta_{return} (q, a, g)|$ == 1 then $|\delta_{call} (q, a)|$ == 0, $|\delta_{call} (q, \eps)|$ == 0, $|\delta_{return} (q, \eps, g)|$ == 0, $|\delta_{local} (q, a)|$ == 0, $|\delta_{local} (q, \eps)|$ == 0, \forall q \in Q, a \in T, and g \in G if $|\delta_{local} (q, a)|$ == 1 then $|\delta_{call} (q, a)|$ == 0, $|\delta_{call} (q, \eps)|$ == 0, $|\delta_{return} (q, a, g)|$ == 0, $|\delta_{return} (q, \eps, g)|$ == 0, $|\delta_{local} (q, \eps)|$ == 0, \forall q \in Q, a \in T, and g \in G
| InputSymbolTypeT | used for the terminal alphabet |
| PushdownSymbolTypeT | used for the pushdown store alphabet |
| StateTypeT | used to the states, and the initial state of the automaton. |
| typedef InputSymbolTypeT automaton::RealTimeHeightDeterministicDPDA< InputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >::InputSymbolType |
| typedef PushdownStoreSymbolTypeT automaton::RealTimeHeightDeterministicDPDA< InputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >::PushdownStoreSymbolType |
| using automaton::RealTimeHeightDeterministicDPDA< InputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >::PushdownStoreSymbolType_t = PushdownStoreSymbolType |
PushdownStoreSymbolType template param
| typedef StateTypeT automaton::RealTimeHeightDeterministicDPDA< InputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >::StateType |
| using automaton::RealTimeHeightDeterministicDPDA< InputSymbolTypeT, PushdownStoreSymbolTypeT, StateTypeT >::StateType_t = StateType |
StateType template param
|
explicit |
Creates a new instance of the automaton with a concrete set of states, call, return, and local alphabets, pushdown store alphabet, initial state, bottom of the stack symbol, and a set of final states.
| states | the initial set of states of the automaton |
| callAlphabet | the initial input alphabet |
| returnAlphabet | the initial input alphabet |
| localAlphabet | the initial input alphabet |
| pushdownStoreAlphabet | the initial set of symbols used in the pushdown store by the automaton |
| initialState | the initial state of the automaton |
| bottomOfTheStackSymbol | the initial pushdown symbol of the automaton |
| finalStates | the initial set of final states of the automaton |
|
explicit |
Creates a new instance of the automaton with a concrete initial state and bottom of the stack symbol.
| initialState | the initial state of the automaton |
| bottomOfTheStackSymbol | the bottom of the stack symbol of the automaton |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addCallTransition | ( | StateType | from, |
| common::symbol_or_epsilon< InputSymbolType > | input, | ||
| StateType | to, | ||
| PushdownStoreSymbolType | push | ||
| ) |
Adds a call transition to the automaton.
The transition is in a form A \times a -> B \times g, where A, B \in Q, a \in T \cup { \eps }, and g \in G
| from | the source state (A) |
| input | the input symbol or epsilon (a) |
| to | the target state (B) |
| push | symbol to be pushed to the pushdown store on the transition use (g) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addCallTransition | ( | StateType | from, |
| InputSymbolType | input, | ||
| StateType | to, | ||
| PushdownStoreSymbolType | push | ||
| ) |
Adds a call transition to the automaton.
The transition is in a form A \times a -> B \times g, where A, B \in Q, a \in T, and g \in G
| from | the source state (A) |
| input | the input symbol (a) |
| to | the target state (B) |
| push | symbol to be pushed to the pushdown store on the transition use (g) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addCallTransition | ( | StateType | from, |
| StateType | to, | ||
| PushdownStoreSymbolType | push | ||
| ) |
Adds a call transition to the automaton.
The transition is in a form A \times \eps -> B \times g, where A, B \in Q, and g \in G
| from | the source state (A) |
| to | the target state (B) |
| push | symbol to be pushed to the pushdown store on the transition use (g) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
|
inline |
Adder of a final state.
| state | the new state to be added to a set of final states |
|
inline |
Adder of a input symbol.
| symbol | the new symbol to be added to an input alphabet |
|
inline |
Adder of input symbols.
| symbols | new symbols to be added to an input alphabet |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addLocalTransition | ( | StateType | from, |
| common::symbol_or_epsilon< InputSymbolType > | input, | ||
| StateType | to | ||
| ) |
Adds a local transition to the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T \cup { \eps }
| from | the source state (A) |
| input | the input symbol or epsilon (a) |
| to | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addLocalTransition | ( | StateType | from, |
| InputSymbolType | input, | ||
| StateType | to | ||
| ) |
Adds a local transition to the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T
| from | the source state (A) |
| input | the call input symbol (a) |
| to | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addLocalTransition | ( | StateType | from, |
| StateType | to | ||
| ) |
Adds a local transition to the automaton.
The transition is in a form A \times \eps -> B, where A, B \in Q
| from | the source state (A) |
| to | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
|
inline |
Adder of a pushdown store symbol.
| symbol | the new symbol to be added to a pushdown store alphabet |
|
inline |
Adder of pushdown store symbols.
| symbols | new symbols to be added to a pushdown store alphabet |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addReturnTransition | ( | StateType | from, |
| common::symbol_or_epsilon< InputSymbolType > | input, | ||
| PushdownStoreSymbolType | pop, | ||
| StateType | to | ||
| ) |
Adds a return transition to the automaton.
The transition is in a form A \times a \times g -> B, where A, B \in Q, a \in T \cup { \eps }, and g \in G
| from | the source state (A) |
| input | the input symbol or epsilon (a) |
| pop | symbol to be poped to the pushdown store on the transition use (g) |
| to | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addReturnTransition | ( | StateType | from, |
| InputSymbolType | input, | ||
| PushdownStoreSymbolType | pop, | ||
| StateType | to | ||
| ) |
Adds a return transition to the automaton.
The transition is in a form A \times a \times g -> B, where A, B \in Q, a \in T, and g \in G
| from | the source state (A) |
| input | the input symbol (a) |
| pop | symbol to be poped to the pushdown store on the transition use (g) |
| to | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::addReturnTransition | ( | StateType | from, |
| PushdownStoreSymbolType | pop, | ||
| StateType | to | ||
| ) |
Adds a return transition to the automaton.
The transition is in a form A \times \eps \times g -> B, where A, B \in Q, and g \in G
| from | the source state (A) |
| pop | symbol to be poped to the pushdown store on the transition use (g) |
| to | the target state (B) |
| AutomatonException | when transition contains state or symbol not present in the automaton components or when the transition would cause nondeterminism |
|
inline |
Adder of a state.
| state | the new state to be added to a set of states |
|
inline |
Getter of the bottom of the stack symbol.
|
inline |
Getter of the bottom of the stack symbol.
| ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > && automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::getCallTransitions | ( | ) | && |
Get the call transition function of the automaton in its natural form.
| const ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, ext::pair< StateType, PushdownStoreSymbolType > > & automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::getCallTransitions | ( | ) | const & |
Get the call transition function of the automaton in its natural form.
|
inline |
Getter of final states.
|
inline |
Getter of final states.
|
inline |
Getter of the initial state.
|
inline |
Getter of the initial state.
|
inline |
Getter of the input alphabet.
|
inline |
Getter of the input alphabet.
| ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > && automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::getLocalTransitions | ( | ) | && |
Get the local transition function of the automaton in its natural form.
| const ext::map< ext::pair< StateType, common::symbol_or_epsilon< InputSymbolType > >, StateType > & automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::getLocalTransitions | ( | ) | const & |
Get the local transition function of the automaton in its natural form.
|
inline |
Getter of the pushdown store alphabet.
|
inline |
Getter of the pushdown store alphabet.
| ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > && automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::getReturnTransitions | ( | ) | && |
Get the return transition function of the automaton in its natural form.
| const ext::map< ext::tuple< StateType, common::symbol_or_epsilon< InputSymbolType >, PushdownStoreSymbolType >, StateType > & automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::getReturnTransitions | ( | ) | const & |
Get the return transition function of the automaton in its natural form.
|
inline |
Getter of states.
|
inline |
Getter of states.
|
inline |
The three way comparison implementation
| other | the other instance |
other.
|
inline |
The equality comparison implementation.
| other | the other object to compare with. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeCallTransition | ( | const StateType & | from, |
| const common::symbol_or_epsilon< InputSymbolType > & | input, | ||
| const StateType & | to, | ||
| const PushdownStoreSymbolType & | push | ||
| ) |
Removes a call transition from the automaton.
The transition is in a form A \times a -> B \times g, where A, B \in Q, a \in T \cup { \eps }, and g \in G
| from | the source state (A) |
| input | the input symbol or epsilon (a) |
| to | the target state (B) |
| push | symbol to be pushed to the pushdown store on the transition use (g) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeCallTransition | ( | const StateType & | from, |
| const InputSymbolType & | input, | ||
| const StateType & | to, | ||
| const PushdownStoreSymbolType & | push | ||
| ) |
Removes a call transition from the automaton.
The transition is in a form A \times a -> B \times g, where A, B \in Q, a \in T, and g \in G
| from | the source state (A) |
| input | the input symbol (a) |
| to | the target state (B) |
| push | symbol to be pushed to the pushdown store on the transition use (g) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeCallTransition | ( | const StateType & | from, |
| const StateType & | to, | ||
| const PushdownStoreSymbolType & | push | ||
| ) |
Removes a call transition from the automaton.
The transition is in a form A \times \eps -> B \times g, where A, B \in Q, and g \in G
| from | the source state (A) |
| to | the target state (B) |
| push | symbol to be pushed to the pushdown store on the transition use (g) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
|
inline |
Remover of a final state.
| state | a state to be removed from a set of final states |
|
inline |
Remover of an input symbol.
| symbol | a symbol to be removed from an input alphabet |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeLocalTransition | ( | const StateType & | from, |
| const common::symbol_or_epsilon< InputSymbolType > & | input, | ||
| const StateType & | to | ||
| ) |
Removes a local transition from the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T \cup { \eps }
| from | the source state (A) |
| input | the input symbol or epsilon (a) |
| to | the target state (B) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeLocalTransition | ( | const StateType & | from, |
| const InputSymbolType & | input, | ||
| const StateType & | to | ||
| ) |
Removes a local transition from the automaton.
The transition is in a form A \times a -> B, where A, B \in Q and a \in T
| from | the source state (A) |
| input | the input symbol (a) |
| to | the target state (B) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeLocalTransition | ( | const StateType & | from, |
| const StateType & | to | ||
| ) |
Removes a local transition from the automaton.
The transition is in a form A \times \eps -> B, where A, B \in Q
| from | the source state (A) |
| to | the target state (B) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
|
inline |
Remover of an pushdown store symbol.
| symbol | a symbol to be removed from a pushdown store alphabet |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeReturnTransition | ( | const StateType & | from, |
| const common::symbol_or_epsilon< InputSymbolType > & | input, | ||
| const PushdownStoreSymbolType & | pop, | ||
| const StateType & | to | ||
| ) |
Removes a return transition from the automaton.
The transition is in a form A \times a \times g -> B, where A, B \in Q, a \in T \cup { \eps }, and g \in G
| from | the source state (A) |
| input | the input symbol or epsilon (a) |
| pop | symbol to be poped to the pushdown store on the transition use (g) |
| to | the target state (B) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeReturnTransition | ( | const StateType & | from, |
| const InputSymbolType & | input, | ||
| const PushdownStoreSymbolType & | pop, | ||
| const StateType & | to | ||
| ) |
Removes a return transition from the automaton.
The transition is in a form A \times a \times g -> B, where A, B \in Q, a \in T, and g \in G
| from | the source state (A) |
| input | the input symbol (a) |
| pop | symbol to be poped to the pushdown store on the transition use (g) |
| to | the target state (B) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
| bool automaton::RealTimeHeightDeterministicDPDA< InputSymbolType, PushdownStoreSymbolType, StateType >::removeReturnTransition | ( | const StateType & | from, |
| const PushdownStoreSymbolType & | pop, | ||
| const StateType & | to | ||
| ) |
Removes a return transition from the automaton.
The transition is in a form A \times \eps \times g -> B, where A, B \in Q, and g \in G
| from | the source state (A) |
| pop | symbol to be poped to the pushdown store on the transition use (g) |
| to | the target state (B) |
| AutomatonException | when removed transition left hand side was found but the right hand side did not match. |
|
inline |
Remover of a state.
| state | a state to be removed from a set of states |
|
inline |
Setter of the bottom of the stack symbol.
| symbol | new bottom of the stack symbol of the automaton |
|
inline |
Setter of final states.
| states | completely new set of final states |
|
inline |
Setter of the initial state.
| state | new initial state of the automaton |
|
inline |
Setter of input alphabet.
| symbols | completely new input alphabet |
|
inline |
Setter of a pushdown store alphabet.
| symbols | completely new pushdown store alphabet |
|
inline |
Setter of states.
| states | completely new set of states |
|
friend |
Print this object as raw representation to ostream.
| out | ostream where to print |
| instance | object to print |