Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef O_COMPILER_H
- #define O_COMPILER_H
- #include <deque>
- #include <vector>
- #include <string>
- #include <fstream>
- #include "main.h"
- // OCompiler:
- class OCompiler
- {
- public:
- // Constructors and destructor.
- OCompiler();
- OCompiler(int temp_loopID);
- OCompiler(char **strInputFile);
- ~OCompiler();
- void RunOCompiler();
- private:
- // Parser functions:
- bool FindFunction();
- void SyntacticAnalys(); // Create ParseTree from O code for TranslateFunction.
- // Translat to C functions:
- void TranslateCodeBlock(); // Use ParseTree to generate C code as output.
- void PrintNumberOfTabs();
- // Variables:
- streampos beginningOfFilePos;
- streampos tempPos;
- int k, i, loopID;
- static int l, g_loopID; // int u used for very, sloppy coding.
- char tempChar;
- string tempToken; // The current token that is being operated on.
- string tempToken_stemComparing;
- static ifstream InputFile;
- static ofstream OutputFile; // The output file will be the same as input file name just with O appending to the begining.
- deque<char> ParseTree; // 0 = command, 1 = if, 2 = code block.
- deque<string> DataDeque; // All C data types.
- deque<string> OperationDeque; // all commands with ; at the end.
- deque<string> ControlStatementDeque; // All if.
- vector<OCompiler> CodeBlockVector; // All new/child code blocks.
- };
- #endif /* O_COMPILER_H */
Advertisement
Add Comment
Please, Sign In to add comment