BenchGen
BenchGen is a tool for generating benchmarks to stress-test a computing system.
|
The lSystem namespace contains functions to apply L-system rules to sequences of tokens, including matching rules and applying production rules. More...
Functions | |
std::vector< Token > | lSystem (int iterations, const std::vector< ProductionRule > &productionRules, const std::vector< Token > &inputTokens) |
Applies L-system rules to generate a sequence of tokens. | |
int | match (std::string match, const std::vector< ProductionRule > &rules) |
Matches a string to a production rule. | |
int | findEqualCall (const std::unordered_map< std::vector< Token >, int, TokenVectorHash, TokenVectorEqual > &callMap, const std::vector< Token > &callTokens) |
Finds an existing call ID for a given set of tokens, if one exists. | |
void | applyCallIds (std::list< Token > &outputTokens, int &callCounter) |
Applies call IDs to sequences of tokens representing function calls. | |
void | applyProductionRules (std::list< Token > &outputTokens, const std::vector< ProductionRule > &productionRules) |
Applies production rules to the output tokens. | |
The lSystem namespace contains functions to apply L-system rules to sequences of tokens, including matching rules and applying production rules.
void lSystem::applyCallIds | ( | std::list< Token > & | outputTokens, |
int & | callCounter ) |
Applies call IDs to sequences of tokens representing function calls.
Processes the output tokens to assign unique call IDs to sequences representing function calls, ensuring that each unique call sequence has a unique ID.
outputTokens | A list of tokens representing the current state of the output. |
callCounter | A reference to the counter used for assigning new call IDs. |
void lSystem::applyProductionRules | ( | std::list< Token > & | outputTokens, |
const std::vector< ProductionRule > & | productionRules ) |
Applies production rules to the output tokens.
Replaces tokens in the output that match a production rule with the corresponding production, modifying the output sequence accordingly.
outputTokens | A list of tokens representing the current state of the output. |
productionRules | The vector of production rules to apply to the output. |
int lSystem::findEqualCall | ( | const std::unordered_map< std::vector< Token >, int, TokenVectorHash, TokenVectorEqual > & | callMap, |
const std::vector< Token > & | callTokens ) |
Finds an existing call ID for a given set of tokens, if one exists.
Checks if a given sequence of tokens has already been assigned a call ID.
callMap | A map of token sequences to their corresponding call IDs. |
callTokens | The vector of tokens representing the call to check. |
std::vector< Token > lSystem::lSystem | ( | int | iterations, |
const std::vector< ProductionRule > & | productionRules, | ||
const std::vector< Token > & | inputTokens ) |
Applies L-system rules to generate a sequence of tokens.
Takes an initial set of tokens, applies the specified production rules for a given number of iterations, and generates a new sequence of tokens based on the rules.
iterations | The number of times the production rules should be applied. |
productionRules | The production rules to apply, represented as a vector of ProductionRule objects. |
inputTokens | The initial vector of Tokens to which the rules are applied. |
int lSystem::match | ( | std::string | match, |
const std::vector< ProductionRule > & | rules ) |
Matches a string to a production rule.
Searches for a match between a given string and the rules in the provided vector.
match | The string to match against the production rules. |
rules | The vector of production rules to search. |