modernize code
This commit is contained in:
33
PCCcompiler/compiler_types.h
Normal file
33
PCCcompiler/compiler_types.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#ifndef COMPILER_TYPES_H
|
||||
#define COMPILER_TYPES_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
|
||||
struct Expression {
|
||||
std::string leftVar;
|
||||
std::string op;
|
||||
std::string rightVar;
|
||||
std::string resultVar;
|
||||
};
|
||||
|
||||
struct IfBlock {
|
||||
std::string conditionVar;
|
||||
std::vector<std::string> prints;
|
||||
};
|
||||
|
||||
struct CompilerState {
|
||||
std::vector<Expression> expressions;
|
||||
std::vector<IfBlock> ifBlocks;
|
||||
std::map<std::string, int> variables;
|
||||
std::vector<std::string> printCalls;
|
||||
std::vector<std::string> globalPrints;
|
||||
std::map<std::string, std::vector<std::string>> functions;
|
||||
bool inFunction = false;
|
||||
std::string currentFunction;
|
||||
std::stack<bool> braceStack;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user