-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
51 lines (38 loc) · 945 Bytes
/
main.cpp
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
#include <stdio.h>
#include <iostream>
#include "Driver.h"
int yyerror(char const * err)
{
printf("hest\n");
return 0;
}
int yyerror(char const * err, ...)
{
std::cerr << "Cannot parse input: " << err;
return 0;
}
enum class ProgramError
{
NoError = 0,
TooFewArguments,
TooManyArguments,
};
int main(int argc, char ** argv)
{
if(argc <2 ) {
std::cerr << "Too few arguments to program: " << argv[0] << std::endl;
return (int)ProgramError::TooFewArguments;
}
else if(argc>3) {
std::cerr << "Too many arguments to program: " << argv[0] << std::endl;
return (int)ProgramError::TooManyArguments;
}
std::string filename(argv[1]);
std::string prettyPrintedFile;
if(argc>=3)
prettyPrintedFile = std::string(argv[2]);
Metal::Driver driver;
std::cout << "Filename = " + filename << std::endl;
driver.convert(filename, prettyPrintedFile );
return (int)ProgramError::NoError;
}