#ifndef __SCC_SEMA_H__ #define __SCC_SEMA_H__ #include typedef struct scc_sema_ctx scc_sema_ctx_t; /** * @brief 语义分析回调函数类型 */ typedef void (*scc_sema_callback_t)(scc_sema_ctx_t *context, scc_ast_node_kind_t node_type, void *node); typedef const scc_ast_qual_type_t *(*scc_sema_got_type_t)( scc_sema_ctx_t *context, const char *name); /** * @brief 语义分析回调集合 */ struct scc_sema_ctx { scc_sema_callback_t on_decl; scc_sema_callback_t on_stmt; scc_sema_callback_t on_expr; scc_sema_callback_t on_type; scc_sema_got_type_t got_type; scc_ast_ctx_t *ast_ctx; scc_ast_stmt_vec_t break_stack; scc_ast_stmt_vec_t continue_stack; void *context; }; void scc_sema_init(scc_sema_ctx_t *sema_ctx, scc_ast_ctx_t *ast_ctx); void scc_sema_drop(scc_sema_ctx_t *sema_ctx); #endif /* __SCC_SEMA_H__ */