Piethon  1.0
A Python-like interpreter using flex and bison.
main.cpp
Go to the documentation of this file.
1 #include <iostream>
2 #include <cstdio>
3 
4 using std::cerr;
5 using std::endl;
6 
7 extern int yyparse();
8 extern int parseResult;
9 extern FILE* yyin;
10 
11 int main(int argc, char** argv) {
12 
13  // if a filename was passed on the command line, attempt to open handle for parsing
14  if (argc > 1) {
15  yyin = fopen(argv[1], "r+");
16 
17  if (yyin == NULL) {
18  cerr << "error: could not open file \"" << argv[1] << "\" for reading" << endl;
19  return 3;
20  }
21  }
22 
23  // else, we are reading from STDIN
24  yyparse();
25 
26  return parseResult;
27 }
int main(int argc, char **argv)
Definition: main.cpp:11
FILE * yyin
int parseResult
int yyparse()