语法/前端解析,构建AST

This commit is contained in:
jing
2025-12-29 16:24:29 +08:00
parent 8903bf73f9
commit c153604c2e
8 changed files with 388 additions and 36 deletions

16
src/frontend/AstBuilder.h Normal file
View File

@@ -0,0 +1,16 @@
// 将 ANTLR parse tree 转换为内部 AST。
#pragma once
#include <memory>
namespace antlr4 {
namespace tree {
class ParseTree;
}
} // namespace antlr4
namespace ast {
struct CompUnit;
}
std::shared_ptr<ast::CompUnit> BuildAst(antlr4::tree::ParseTree* tree);