Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
epidemian
GitHub Repository: epidemian/gravity
Path: blob/master/src/compiler/gravity_symboltable.h
1214 views
1
//
2
// gravity_symboltable.h
3
// gravity
4
//
5
// Created by Marco Bambini on 12/09/14.
6
// Copyright (c) 2014 CreoLabs. All rights reserved.
7
//
8
9
#ifndef __GRAVITY_SYMTABLE__
10
#define __GRAVITY_SYMTABLE__
11
12
#include "debug_macros.h"
13
#include "gravity_ast.h"
14
15
typedef struct symboltable_t symboltable_t;
16
17
symboltable_t *symboltable_create (bool is_enum);
18
gnode_t *symboltable_lookup (symboltable_t *table, const char *identifier);
19
gnode_t *symboltable_global_lookup (symboltable_t *table, const char *identifier);
20
bool symboltable_insert (symboltable_t *table, const char *identifier, gnode_t *node);
21
uint32_t symboltable_count (symboltable_t *table, uint32_t index);
22
23
void symboltable_enter_scope (symboltable_t *table);
24
uint32_t symboltable_exit_scope (symboltable_t *table, uint32_t *nlevel);
25
uint32_t symboltable_local_index (symboltable_t *table);
26
void symboltable_free (symboltable_t *table);
27
void symboltable_dump (symboltable_t *table);
28
29
#endif
30
31