Advertisement
m4v1

main.cpp

Nov 14th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.84 KB | None | 0 0
  1. #include <cstdio>
  2. #include "ast.h"
  3. #include "tokens.h"
  4.  
  5. DeclarationList *decl_list;
  6. Statement *input;
  7. extern map<string, VValue> vars;
  8.  
  9. int main()
  10. {
  11.     input = NULL;
  12.     yyparse();
  13.    
  14.     if (decl_list != NULL) {
  15.         VValue v;
  16.         DeclarationList::iterator it = decl_list->begin();
  17.        
  18.         while (it != decl_list->end()) {
  19.             Declaration *decl = *it;
  20.             StringList::iterator it2 = decl->idList.begin();
  21.            
  22.             while (it2 != decl->idList.end()) {
  23.                 string id = *it2;
  24.                
  25.                 v.type = decl->type;
  26.                 vars[id] = v;
  27.                
  28.                 it2++;
  29.             }
  30.             it ++;
  31.        
  32.         delete decl;
  33.         }
  34.        
  35.         delete decl_list;
  36.     }
  37.  
  38.     if (input != 0) {
  39.         input->execute();
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement