-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLanguageParserControl.cpp
More file actions
57 lines (43 loc) · 1.73 KB
/
LanguageParserControl.cpp
File metadata and controls
57 lines (43 loc) · 1.73 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
Group Members: David Guido, Tim, Bradley, Josh
Course: CPSC 323, Compilers and Languages
Meeting Times: T/TH 4:00pm - 5:15pm
Due Date: December 15, 2019
Semester: Fall 19'
Assignment: Group Project (Language Parser)
Files Included: 1.) LanguageParser.cpp
2.) LanguageParser.h
3.) LanguageParserControl.cpp
****************************************************************/
#include <iostream> // C++ library imports
#include <fstream>
#include <string>
#include "LanguageParser.h" // Custom class imports
using namespace std;
bool FileExists(string inputFileName); // Declarations
bool FileContainsContent(string inputFileName);
void ParseHandler ();
bool exist(std::string filename) ; //Function to check if file exists
LanguageParser langParserInstance; // Single instance obj, namespace: 'Parser'
int main() // Entry point
{
if(exist("revised.txt"))
remove("revised.txt");
if (langParserInstance.OpenFileIn("final.txt"))
{
langParserInstance.HandleInput();
langParserInstance.CloseFile();
langParserInstance.OpenFileOut("revised.txt");
langParserInstance.WriteFile();
}
return 0; // Exit point
}
bool exist(std::string filename)
{
bool result;
std::ifstream infile;
infile.open(filename);
result = (infile ? true : false); //If infile could be opened, it exists so RETURN TRUE, else RETURN FALSE
infile.close();
return result;
}