This commit is contained in:
jing
2025-12-29 20:11:51 +08:00
parent c153604c2e
commit e1c1f2a40d
14 changed files with 402 additions and 27 deletions

View File

@@ -3,3 +3,15 @@
// - 解析输出类型IR/MIR/ASM与优化级别等选项
// - 将参数传递给 main.cpp 的编译流水线驱动
#include "utils/CLI.h"
#include <stdexcept>
CLIOptions ParseCLI(int argc, char** argv) {
if (argc <= 1) {
throw std::runtime_error("用法: compiler <input.sy>");
}
CLIOptions opt;
opt.input = argv[1];
return opt;
}

10
src/utils/CLI.h Normal file
View File

@@ -0,0 +1,10 @@
// 简易命令行解析:仅支持输入文件路径。
#pragma once
#include <string>
struct CLIOptions {
std::string input;
};
CLIOptions ParseCLI(int argc, char** argv);

View File

@@ -2,3 +2,4 @@
// - 统一输出调试信息、阶段信息与错误信息
// - 提供可配置的日志级别与输出位置(按需要实现)
#include "utils/Log.h"