statement builders finished

This commit is contained in:
ProgramSnail 2023-07-23 19:40:27 +03:00
parent 64a91299ff
commit 4470454838
19 changed files with 682 additions and 255 deletions

View file

@ -1,3 +1,42 @@
int main() {
return 0;
#include <fstream>
#include <iostream>
#include <sstream>
#include "error_handling.hpp"
#include "expression_nodes.hpp"
#include "statement_builders.hpp"
#include "type_nodes.hpp"
int main(int argc, char **argv) {
if (argc < 2 || argc > 2) {
std::cout << "Wrong argument count (one argument should be provided - "
"source file)\n";
return 0;
}
std::string filename = argv[1];
std::ifstream in;
in.open(filename);
std::stringstream source_stream;
source_stream << in.rdbuf();
in.close();
std::string source = source_stream.str();
parser::ParseTree parse_tree(source);
if (!parse_tree.is_properly_parsed()) {
error_handling::handle_parsing_error(
"There are some parsing errors in file", parse_tree.get_root());
}
nodes::ExpressionStorage expression_storage;
nodes::TypeStorage type_storage;
builders::build_source_file(parse_tree.get_root(), expression_storage,
type_storage);
}