Algorithms Library Toolkit
A toolkit for algorithms, especially for algorithms on formal languages
Static Public Member Functions
grammar::generate::RandomGrammarFactory Class Reference

#include <RandomGrammarFactory.h>

Static Public Member Functions

template<class TerminalSymbolType , class NonterminalSymbolType >
static grammar::CFG< TerminalSymbolType, NonterminalSymbolType > generateCFG (ext::set< NonterminalSymbolType > nonterminals, ext::set< TerminalSymbolType > terminals, double density)
 
static grammar::CFG< std::string, std::string > generateCFG (size_t nonterminalsCount, size_t terminalsCount, bool randomizedAlphabet, double density)
 

Member Function Documentation

◆ generateCFG() [1/2]

template<class TerminalSymbolType , class NonterminalSymbolType >
grammar::CFG< TerminalSymbolType, NonterminalSymbolType > grammar::generate::RandomGrammarFactory::generateCFG ( ext::set< NonterminalSymbolType >  nonterminals,
ext::set< TerminalSymbolType >  terminals,
double  density 
)
static

Generates a random context free grammar.

Template Parameters
TerminalSymbolTypethe type of terminal symbols of the random grammar
NonterminalSymbolTypethe type of nonterminal symbols of the random grammar
Parameters
nonterminalsthe nonterminals in the generated grammar
terminalsthe terminals in the generated grammar
densitydensity of the rule set of the generated grammar
Returns
random context free grammar
Here is the call graph for this function:

◆ generateCFG() [2/2]

grammar::CFG< std::string, std::string > grammar::generate::RandomGrammarFactory::generateCFG ( size_t  nonterminalsCount,
size_t  terminalsCount,
bool  randomizedAlphabet,
double  density 
)
static

Generates a random context free grammar.

Template Parameters
TerminalSymbolTypethe type of terminal symbols of the random grammar
NonterminalSymbolTypethe type of nonterminal symbols of the random grammar
Parameters
nonterminalsCountnumber of nonterminals in the generated grammar
terminalsSizethe number of terminals used in the generated grammar
randomizedAlphabetselects random symbols from a-z range for terminal and A-Z for nonterminal alphabet if true
densitydensity of the rule set of the generated grammar
Returns
random context free grammar
Here is the call graph for this function:

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