ready to build AST

This commit is contained in:
2024-08-08 13:05:56 +00:00
parent f1eb6abcc1
commit 9900d5aaf3
23 changed files with 683 additions and 110 deletions

View File

@ -21,8 +21,18 @@ int main(int argc, char **argv) {
auto input_file = program.get<std::string>("input");
auto output_file = program.get<std::string>("output");
std::ifstream fin(input_file);
int err_code = SemanticCheck(fin);
if (err_code != 0) return err_code;
std::shared_ptr<ASTNodeBase> ast;
try {
SemanticCheck(fin, ast);
} catch (const SemanticError &err) {
std::cout << err.what() << std::endl;
return err.GetErrorCode();
} catch (const std::exception &err) {
std::cout << "Unknown error: " << err.what() << std::endl;
return 254;
} catch (...) {
std::cout << "Unknown error without message" << std::endl;
return 255;
}
return 0;
}