feat(ast): 添加AST定义和dump工具头文件
新增libs/ast模块的基础定义文件,包括: - AST节点类型枚举定义,涵盖声明、语句、表达式、类型等各类节点 - AST操作符枚举,定义所有二元、一元、逻辑、算术等操作符 - AST节点结构体定义,包含表达式、语句、声明、类型等具体实现 - AST dump工具接口,支持树形结构输出和颜色显示 - 语义分析回调函数类型定义,为后续语义分析提供基础
This commit is contained in:
23
libs/ast/include/scc_ast.h
Normal file
23
libs/ast/include/scc_ast.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef __SCC_AST_H__
|
||||
#define __SCC_AST_H__
|
||||
|
||||
#include "ast_def.h"
|
||||
|
||||
/**
|
||||
* @brief 语义分析回调函数类型
|
||||
*/
|
||||
typedef void (*scc_sema_callback_t)(void *context,
|
||||
scc_ast_node_type_t node_type, void *node);
|
||||
|
||||
/**
|
||||
* @brief 语义分析回调集合
|
||||
*/
|
||||
typedef struct scc_sema_callbacks {
|
||||
scc_sema_callback_t on_decl;
|
||||
scc_sema_callback_t on_stmt;
|
||||
scc_sema_callback_t on_expr;
|
||||
scc_sema_callback_t on_type;
|
||||
void *context;
|
||||
} scc_sema_callbacks_t;
|
||||
|
||||
#endif /* __SCC_AST_H__ */
|
||||
Reference in New Issue
Block a user