-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
51 lines (46 loc) · 1.33 KB
/
main.cpp
File metadata and controls
51 lines (46 loc) · 1.33 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
#include <iostream>
#include <set>
#include "parser.hpp"
#include "ast.hpp"
extern int yylex();
//extern std::string* target_program;
//extern std::set<std::string> symbols;
extern ASTNode* root;
int main() {
if (!yylex()) {
AST tree(root);
tree.Print();
// delete root;
// root = nullptr;
}
}
// int main() {
// if (!yylex()) {
// // Write initial C++ stuff.
// std::cout << "#include <iostream>" << std::endl;
// std::cout << "int main() {" << std::endl;
//
// // Write declaractions for all variables.
// std::set<std::string>::iterator it;
// for (it = symbols.begin(); it != symbols.end(); it++) {
// std::cout << "double " << *it << ";" << std::endl;
// }
//
// // Write the program itself.
// std::cout << std::endl << "/* Begin program */" << std::endl << std::endl;
// std::cout << *target_program << std::endl;
// std::cout << "/* End program */" << std::endl << std::endl;
//
// // Write print statements for all symbols.
// for (it = symbols.begin(); it != symbols.end(); it++) {
// std::cout << "std::cout << \"" << *it << ": \" << " << *it << " << std::endl;" << std::endl;
// }
//
// // Write terminating brace.
// std::cout << "}" << std::endl;
//
// delete target_program;
// target_program = NULL;
//
// }
// }