IR设计
This commit is contained in:
@@ -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
10
src/utils/CLI.h
Normal file
@@ -0,0 +1,10 @@
|
||||
// 简易命令行解析:仅支持输入文件路径。
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
struct CLIOptions {
|
||||
std::string input;
|
||||
};
|
||||
|
||||
CLIOptions ParseCLI(int argc, char** argv);
|
||||
@@ -2,3 +2,4 @@
|
||||
// - 统一输出调试信息、阶段信息与错误信息
|
||||
// - 提供可配置的日志级别与输出位置(按需要实现)
|
||||
|
||||
#include "utils/Log.h"
|
||||
|
||||
Reference in New Issue
Block a user