BenchGen
BenchGen is a tool for generating benchmarks to stress-test a computing system.
Loading...
Searching...
No Matches
lSystem.h
Go to the documentation of this file.
1#ifndef L_SYSTEM
2#define L_SYSTEM
3
4#include <iostream>
5#include <list>
6#include <unordered_map>
7
9#include "../shared/enums.h"
11
12#define PRODUCTION_TOK TOK_ID
13
18namespace lSystem {
19
31std::vector<Token> lSystem(int iterations, const std::vector<ProductionRule>& productionRules, const std::vector<Token>& inputTokens);
32
42int match(std::string match, const std::vector<ProductionRule>& rules);
43
53int findEqualCall(const std::unordered_map<std::vector<Token>, int, TokenVectorHash, TokenVectorEqual>& callMap, const std::vector<Token>& callTokens);
54
64void applyCallIds(std::list<Token>& outputTokens, int& callCounter);
65
75void applyProductionRules(std::list<Token>& outputTokens, const std::vector<ProductionRule>& productionRules);
76
77} // namespace lSystem
78
79#endif
The lSystem namespace contains functions to apply L-system rules to sequences of tokens,...
Definition lSystem.h:18
void applyProductionRules(std::list< Token > &outputTokens, const std::vector< ProductionRule > &productionRules)
Applies production rules to the output tokens.
Definition lSystem.cpp:76
int match(std::string match, const std::vector< ProductionRule > &rules)
Matches a string to a production rule.
Definition lSystem.cpp:22
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.
Definition lSystem.cpp:30
void applyCallIds(std::list< Token > &outputTokens, int &callCounter)
Applies call IDs to sequences of tokens representing function calls.
Definition lSystem.cpp:37
Equality comparison object for vectors of Tokens.
Definition globalStructs.h:67
Hash function object for a vector of Tokens.
Definition globalStructs.h:42