Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2012
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.90 KB | None | 0 0
  1. //Get rid of this
  2. //using namespace LA;
  3.  
  4. EntryPoint::EntryPoint()
  5. {
  6.     //ctor
  7. }
  8.  
  9. EntryPoint::~EntryPoint()
  10. {
  11.     //dtor
  12. }
  13.  
  14. int main()
  15. {
  16.     std::ifstream indata;
  17.     std::string filename = "prog1.px";
  18.  
  19.     // Reads the source .px file
  20.     indata.open(filename.c_str());
  21.     if(!indata)
  22.     {
  23.         std::cerr << "Error: file could not be opened." << std::endl;
  24.         exit(1);
  25.     }
  26.  
  27.     #ifndef LEXICAL_ANALYSIS
  28.  
  29.     LA::LexicalAnalyzer lexicalAnalyzer(indata);
  30.     lexicalAnalyzer.analyze();
  31.  
  32.     // Checks if some error happened on the lexical analysis
  33.     if(lexicalAnalyzer.hasError())
  34.     {
  35.         lexicalAnalyzer.showErrors();
  36.         exit(1);
  37.     }
  38.     std::cout << "Lexical Analysis successfully performed! \n\n -> Tokens List" << std::endl;
  39.     lexicalAnalyzer.showTokens(); // Show the list of tokens generated on the lexical analysis
  40. }
  41.     #endif // LEXICAL_ANALYSIS
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement