Guest User

Untitled

a guest
Jan 30th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. #ifndef O_COMPILER_H
  2. #define O_COMPILER_H
  3.  
  4.  
  5. #include <deque>
  6. #include <vector>
  7. #include <string>
  8. #include <fstream>
  9. #include "main.h"
  10.  
  11.  
  12. // OCompiler:
  13. class OCompiler
  14. {
  15. public:
  16.     // Constructors and destructor.
  17.     OCompiler();
  18.     OCompiler(int temp_loopID);
  19.     OCompiler(char **strInputFile);
  20.     ~OCompiler();
  21.    
  22.     void RunOCompiler();
  23.    
  24. private:
  25.     // Parser functions:
  26.     bool FindFunction();
  27.     void SyntacticAnalys(); // Create ParseTree from O code for TranslateFunction.
  28.    
  29.     // Translat to C functions:
  30.     void TranslateCodeBlock(); // Use ParseTree to generate C code as output.
  31.     void PrintNumberOfTabs();
  32.    
  33.     // Variables:
  34.     streampos beginningOfFilePos;
  35.     streampos tempPos;
  36.    
  37.     int k, i, loopID;
  38.     static int l, g_loopID; // int u used for very, sloppy coding.
  39.     char tempChar;
  40.     string tempToken; // The current token that is being operated on.
  41.     string tempToken_stemComparing;
  42.    
  43.     static ifstream InputFile;
  44.     static ofstream OutputFile; // The output file will be the same as input file name just with O appending to the begining.
  45.    
  46.     deque<char> ParseTree; // 0 = command, 1 = if, 2 = code block.
  47.    
  48.     deque<string> DataDeque;                // All C data types.
  49.     deque<string> OperationDeque;           // all commands with ; at the end.
  50.     deque<string> ControlStatementDeque;    // All if.
  51.     vector<OCompiler> CodeBlockVector;      // All new/child code blocks.
  52. };
  53.  
  54.  
  55. #endif /* O_COMPILER_H */
Advertisement
Add Comment
Please, Sign In to add comment