combined symbol table with IR in this branch

This commit is contained in:
Partho
2025-04-25 13:01:31 -04:00
parent 97ef6fa462
commit f0d81ff5fd
7 changed files with 552 additions and 16 deletions

View File

@ -1005,7 +1005,7 @@ constant:
{
char* temp = temp_var_gen();
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, stri, temp, NULL);
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK)
emit_assignment(node, tn_or_const(STRING,$1));
printdebug("string of C_STRING in constant is %s", $1);
$$ = node;
}
@ -1014,7 +1014,7 @@ constant:
{
char* temp = temp_var_gen();
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, integ, temp, NULL);
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK)
emit_assignment(node, tn_or_const(INTEGER,&$1));
printdebug("number of C_INTEGER in constant is %d", $1);
$$ = node;
}
@ -1023,7 +1023,7 @@ constant:
{
char* temp = temp_var_gen();
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, addr, temp, NULL);
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK)
emit_assignment(node, tn_or_const(ADDRESS,$1));
printdebug("string of C_NULL in constant is NULL");
$$ = node;
}
@ -1032,7 +1032,7 @@ constant:
{
char* temp = temp_var_gen();
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, chara, temp, NULL);
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK)
emit_assignment(node, tn_or_const(CHARACTER,&$1));
printdebug("string of C_CHARACTER in constant is %s",$1);
$$ = node;
}
@ -1041,7 +1041,8 @@ constant:
{
char* temp = temp_var_gen();
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, boo, temp, NULL);
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK)
uint_least8_t b = 1;
emit_assignment(node, tn_or_const(BOOLEAN,&b));
printdebug("string of C_TRUE in constant is true");
$$ = node;
}
@ -1050,7 +1051,8 @@ constant:
{
char* temp = temp_var_gen();
TableNode* node = CreateEntry(cur,TYPE_PRIMITIVE, boo, temp, NULL);
//NOTE ADD ASSIGNMENT EMIT HERE (MIGHT NEED TO PUSH TO STACK)
uint_least8_t b = 0;
emit_assignment(node, tn_or_const(BOOLEAN,&b));
printdebug("string of C_FALSE in constant is false");
$$ = node;
}