41 lines
717 B
C
41 lines
717 B
C
#ifndef RES_H
|
|
#define RES_H
|
|
|
|
#include "ast.h"
|
|
#include "collection.h"
|
|
|
|
typedef enum {
|
|
OldSym_Typedef,
|
|
OldSym_Declarator,
|
|
} OldSymTy;
|
|
|
|
typedef struct {
|
|
OldSymTy ty;
|
|
union {
|
|
struct {
|
|
AstStmt* stmt;
|
|
AstDeclar* declar;
|
|
} declarator;
|
|
};
|
|
} OldSym;
|
|
|
|
typedef struct Syms Syms;
|
|
|
|
Syms* syms_new();
|
|
void syms_free(Syms* s);
|
|
|
|
void syms_push_scope(Syms* s);
|
|
void syms_pop_scope(Syms* s);
|
|
|
|
void syms_define(Syms* s, const char* ident, OldSym* sym);
|
|
OldSym* syms_get(Syms* s, const char* ident);
|
|
|
|
typedef struct Resolver Resolver;
|
|
|
|
Resolver* resolver_new(Arena* arena);
|
|
void resolver_free(Resolver* r);
|
|
|
|
void resolver_resolve_top_stmt(Resolver* r, AstStmt* stmt);
|
|
|
|
#endif
|