feat(dev): 支持 compiler --help 输出帮助信息

This commit is contained in:
Lane0218
2025-12-30 12:33:36 +08:00
parent c0c9f70f16
commit 9eefbb5ef7
5 changed files with 55 additions and 4 deletions

View File

@@ -3,3 +3,19 @@
// - 提供可配置的日志级别与输出位置(按需要实现)
#include "utils/Log.h"
#include <ostream>
void PrintHelp(std::ostream& os) {
os << "SysY Compiler (课程实验最小可运行示例)\n"
<< "\n"
<< "用法:\n"
<< " compiler [--help] <input.sy>\n"
<< "\n"
<< "选项:\n"
<< " -h, --help 打印帮助信息并退出\n"
<< "\n"
<< "说明:\n"
<< " - 当前默认将 IR 输出到标准输出,可使用重定向写入文件:\n"
<< " compiler test/test_case/simple_add.sy > out.ll\n";
}