void namePrimitive(t_tree node)
{
	if (node == NULL)
		return;

	if (node->Kind == kFunction)
		nameFunction(node);
	else
	{
		nameCurrentPrimitive = node;
		nameFunction(node->Node.Primitive.Functions);

		nameCurrentPrimitive = NULL;
		namePrimitive(node->Node.Primitive.Next);
	}
}
Exemplo n.º 2
0
void nameFunction(t_tree node)
{
	if (node == NULL)
		return;
	
	checkIdExists(node->Node.Function.Name, node->LineNr, node->Node.Function.Type, NAME_TABLE_FUNCTION);
	scope = FindId(node->Node.Function.Name, scope);
		
	nameVariable(node->Node.Function.Variables);

	nameStmnt(node->Node.Function.Stmnts);

	scope = scope->parent;
	nameFunction(node->Node.Function.Next);
}
Exemplo n.º 3
0
t_symtable *nameProgram(t_tree node)
{
	scope = createFunctionTable(NULL, 0); // create "empty" function symbol table to use as global scope
	nameFunction(node->Node.Program.Functions);
	return scope; // return the global scope
}