feat(frontend): 命令行添加IR和AST选择输出

This commit is contained in:
jing
2026-02-28 23:40:05 +08:00
parent d08b23276a
commit 66659524c8
7 changed files with 75 additions and 16 deletions

View File

@@ -10,13 +10,17 @@ void PrintHelp(std::ostream& os) {
os << "SysY Compiler (课程实验最小可运行示例)\n"
<< "\n"
<< "用法:\n"
<< " compiler [--help] [--ast-dot <file.dot>] <input.sy>\n"
<< " compiler [--help] [--emit-ast] [--emit-ir] [--ast-dot <file.dot>] <input.sy>\n"
<< "\n"
<< "选项:\n"
<< " -h, --help 打印帮助信息并退出\n"
<< " --emit-ast 仅在显式模式下启用 AST 文本输出\n"
<< " --emit-ir 仅在显式模式下启用 IR 输出\n"
<< " --ast-dot <path> 导出 AST Graphviz DOT 到指定文件\n"
<< "\n"
<< "说明:\n"
<< " - 当前默认将 IR 输出到标准输出,可使用重定向写入文件:\n"
<< " - 默认同时输出 AST 与 IR\n"
<< " - 若使用 --emit-ast/--emit-ir则仅输出显式选择的阶段\n"
<< " - 可使用重定向写入文件:\n"
<< " compiler test/test_case/simple_add.sy > out.ll\n";
}