Fixes for state generation to reduce memory usage - adding in optional semicolons balooned our memory usage to somewhere under 8 gigs, with some simple refactoring we're back down to a bit over 4. Needs to be smaller, but it's an improvement
This commit is contained in:
@@ -12,9 +12,15 @@
|
||||
#include <iostream>
|
||||
|
||||
class ParseRule {
|
||||
private:
|
||||
int pointerIndex;
|
||||
Symbol leftHandle;
|
||||
std::vector<Symbol> lookahead;
|
||||
std::vector<Symbol> rightSide;
|
||||
|
||||
public:
|
||||
ParseRule();
|
||||
ParseRule(Symbol leftHandle, int pointerIndex, std::vector<Symbol> &rightSide, std::vector<Symbol>* lookahead);
|
||||
ParseRule(Symbol leftHandle, int pointerIndex, std::vector<Symbol> &rightSide, std::vector<Symbol> lookahead);
|
||||
~ParseRule();
|
||||
const bool equalsExceptLookahead(const ParseRule &other) const;
|
||||
bool const operator==(const ParseRule &other) const;
|
||||
@@ -36,19 +42,12 @@ class ParseRule {
|
||||
bool advancePointer();
|
||||
bool isAtEnd();
|
||||
|
||||
void setLookahead(std::vector<Symbol>* lookahead);
|
||||
void addLookahead(std::vector<Symbol>* lookahead);
|
||||
std::vector<Symbol>* getLookahead();
|
||||
void setLookahead(std::vector<Symbol> lookahead);
|
||||
void addLookahead(std::vector<Symbol> lookahead);
|
||||
std::vector<Symbol> getLookahead();
|
||||
|
||||
std::string toString(bool printLookahead = true);
|
||||
std::string toDOT();
|
||||
|
||||
private:
|
||||
int pointerIndex;
|
||||
Symbol leftHandle;
|
||||
std::vector<Symbol>* lookahead;
|
||||
std::vector<Symbol> rightSide;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user