From b903a8d7e9920388acb59cda634f075f5fdf5ca2 Mon Sep 17 00:00:00 2001 From: ZhuangYumin Date: Sat, 24 Aug 2024 01:41:32 +0000 Subject: [PATCH] use standard schema --- Makefile | 2 +- src/main.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 52c646b..d3c004f 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ build: # 运行目标,运行生成的可执行文件 run: - @cd $(BUILD_DIR) && ./zmxcc /dev/stdin -o /dev/null 2>/dev/null + @cd $(BUILD_DIR) && ./zmxcc /dev/stdin -o /dev/stdout 2>/dev/null # 清理目标 clean: diff --git a/src/main.cpp b/src/main.cpp index 69bf237..12328e4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -22,11 +22,12 @@ int main(int argc, char **argv) { auto input_file = program.get("input"); auto output_file = program.get("output"); std::ifstream fin(input_file); + std::ofstream fout(output_file); std::shared_ptr ast; try { SemanticCheck(fin, ast); auto IR = BuildIR(ast); - IR->RecursivePrint(std::cout); + IR->RecursivePrint(fout); } catch (const SemanticError &err) { std::cout << err.what() << std::endl; return err.GetErrorCode();