ready to build AST
This commit is contained in:
16
src/main.cpp
16
src/main.cpp
@ -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;
|
||||
}
|
Reference in New Issue
Block a user