-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.cpp
More file actions
51 lines (33 loc) · 843 Bytes
/
main.cpp
File metadata and controls
51 lines (33 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//
// main.cpp
// Lab1-Lexical-analyzer
//
// Created by Shinjin Ethan Harris on 9/24/18.
// Copyright © 2018 Shinjin Ethan Harris. All rights reserved.
//
#include <iostream>
#include <string>
#include "Token.h"
#include "Scanner.hpp"
using namespace std;
int main(int argc, const char * argv[]) {
if(argc > 1){
string filename = argv[1];
ifstream file;
file.open(filename);
if (!file.good()){
cout << "File " << filename << " is not acceptable" << endl;
file.close();
return 0;
}
else {
Scanner* scan;
scan = new Scanner(file);
scan->Lex();//begin to scan
scan->print();//print out the vector of tokens
delete scan;
}
file.close();
}
return 0;
}