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
}
main
int main(int argc, char **argv)
Definition:
main.cpp:11
yyin
FILE * yyin
parseResult
int parseResult
yyparse
int yyparse()
Generated on Tue Jan 19 2021 23:43:11 for Piethon by
1.8.13