#include #include #include #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); }