Newer
Older
s_ast_node *ast_sep_create(s_ast_node *lhs, s_ast_node *rhs)
node->type = T_SEP;
node->body.child_sep.lhs = lhs;
node->body.child_sep.rhs = rhs;
return node;
}
void ast_sep_print(s_ast_node *node, FILE *fs, unsigned int *node_id)
{
unsigned int lhs_id, rhs_id, cur_id;
if (node->type != T_SEP)
return;
fprintf(fs, "%u [label = \";\"];\n", cur_id = *node_id);
lhs_id = ++*node_id;
ast_print_node(node->body.child_sep.lhs, fs, node_id);
fprintf(fs, "%u -> %u\n", cur_id, lhs_id);
rhs_id = *node_id;
ast_print_node(node->body.child_sep.rhs, fs, node_id);
fprintf(fs, "%u -> %u\n", cur_id, rhs_id);
}