Skip to content
Snippets Groups Projects
Commit d6b263fc authored by w328li's avatar w328li
Browse files

fix create_and_operator error

parent d00a16cc
No related branches found
No related tags found
1 merge request!5Dev Merge into Master
No preview for this file type
......@@ -85,6 +85,7 @@ cons_cell* create_op(char *op) {
// todo: why need ra
cons_cell* create_comp_operator(cons_cell* op, cons_cell* term1, cons_cell* term2, cons_cell* ra) {
cons_cell* ra_cons = create_cons_cell(ra, NULL);
cons_cell* term2_cons = create_cons_cell(term2, ra_cons);
cons_cell* term1_cons = create_cons_cell(term1, term2_cons);
......@@ -103,7 +104,6 @@ cons_cell* create_atom_operator(cons_cell* table, cons_cell* var) {
return operator_cons;
}
// todo: why pass NULL
cons_cell* create_union_all_operator(cons_cell* ra1, cons_cell* ra2) {
cons_cell* ra2_cons = create_cons_cell(ra2, NULL);
cons_cell* ra1_cons = create_cons_cell(ra1, ra2_cons);
......@@ -121,6 +121,7 @@ cons_cell* create_union_operator(cons_cell* ra1, cons_cell* ra2) {
}
cons_cell* create_and_operator(cons_cell* ra1, cons_cell* ra2) {
printf("create_and_operator called \n");
cons_cell* ra2_cons = create_cons_cell(ra2, NULL);
cons_cell* ra1_cons = create_cons_cell(ra1, ra2_cons);
char operator[4] = "AND\0";
......@@ -219,10 +220,12 @@ void print_cons_tree_helper(cons_cell *root, int indent) {
}
printf("%s", ((atom*)root->car)->val);
printf("\n");
// printf("one\n");
print_cons_tree_helper(root->cdr, indent+1);
} else {
// printf("two\n");
print_cons_tree_helper((cons_cell*)root->car, indent);
// printf("three\n");
print_cons_tree_helper(root->cdr, indent);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment