How to create character tables for different lexical levels?

I am in the middle of creating a compiler for a C-like language. I did a few with the lexer and parser. Right now, I'm trying to do semantic analysis and trying to create character tables. Now, according to the specifications, duplicate declarations are not allowed at the same lexical level. This requires creating a different character table for each lexical level, right? How should I do it? At the moment, the one character table I have is in the form of a binary tree, where each node looks like this:

struct tree_el
{
    char *identifier;
    char *type;
    struct tree_el *right, *left;
}

How to point a specific node to the "root" node of another tree?

Any help would be great! Many thanks.

+3
source share
2

, , : " " , , .

:

int i,j,k;

while (i) {
   int q, r, s;

   ...
}

, , i j k, . while "push" q r s. while, "" q r s ..

+1

, , . , , , .

0

Source: https://habr.com/ru/post/1788801/


All Articles