use standard schema
This commit is contained in:
2
Makefile
2
Makefile
@ -13,7 +13,7 @@ build:
|
|||||||
|
|
||||||
# 运行目标,运行生成的可执行文件
|
# 运行目标,运行生成的可执行文件
|
||||||
run:
|
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:
|
clean:
|
||||||
|
@ -22,11 +22,12 @@ int main(int argc, char **argv) {
|
|||||||
auto input_file = program.get<std::string>("input");
|
auto input_file = program.get<std::string>("input");
|
||||||
auto output_file = program.get<std::string>("output");
|
auto output_file = program.get<std::string>("output");
|
||||||
std::ifstream fin(input_file);
|
std::ifstream fin(input_file);
|
||||||
|
std::ofstream fout(output_file);
|
||||||
std::shared_ptr<Program_ASTNode> ast;
|
std::shared_ptr<Program_ASTNode> ast;
|
||||||
try {
|
try {
|
||||||
SemanticCheck(fin, ast);
|
SemanticCheck(fin, ast);
|
||||||
auto IR = BuildIR(ast);
|
auto IR = BuildIR(ast);
|
||||||
IR->RecursivePrint(std::cout);
|
IR->RecursivePrint(fout);
|
||||||
} catch (const SemanticError &err) {
|
} catch (const SemanticError &err) {
|
||||||
std::cout << err.what() << std::endl;
|
std::cout << err.what() << std::endl;
|
||||||
return err.GetErrorCode();
|
return err.GetErrorCode();
|
||||||
|
Reference in New Issue
Block a user