#ifndef _sema_h_ #define _sema_h_ #include "ast.h" #include "state.h" typedef struct Scope Scope; typedef struct SemaCtx SemaCtx; struct SemaCtx { SemaCtx *prev; Scope *current_scope; Scope *top_scope; Compiler *cm; u64 flags; /* Bit field storing context flags */ struct { DataType *tyu64; DataType *void_t; } builtintypes; bool ok; /* did the semantic check fail */ bool main_defined; }; SemaCtx * sema_new(Compiler *cm); void sema_destroy(SemaCtx *sctx); void sema(SemaCtx *sctx, Ast *program); #endif