Skip to content
Snippets Groups Projects
Commit 8be58de3 authored by JasonJPu's avatar JasonJPu
Browse files

Compiles

parent 31f67726
No related branches found
No related tags found
1 merge request!1SQLP parser with cons cells
......@@ -2,11 +2,7 @@
#include "util.h"
%}
// %union {
// struct node *n;
//}
%define api.value.type {struct node *}
%define api.value.type {cons_cell *}
%token IMPLIES OR AND NOT LE GE LT GT NE HAS MAX MIN AS ASC DESC MOD ASSIGN EQ STAR COMMA DOT
%token SIZE SELECTIVITY OVERLAP
......@@ -96,8 +92,8 @@ Union_Query
Select_List
: STAR
{ printf("star\n");
$$ = new_node(1, Select_List);
$$->children[0] = new_node(0, STAR);
//$$ = new_node(1, Select_List);
//$$->children[0] = new_node(0, STAR);
}
| Col
{ printf("select list attr path\n");
......
File added
......@@ -48,9 +48,31 @@ enum type {
Pred
};
cons_cell* create_cons_cell(void* car, cons_cell* cdr);
atom* create_atom(char* val);
cons_cell* create_cons_cell_w_atom(char* val, cons_cell* cdr);
cons_cell* create_spcol(cons_cell* var, cons_cell* pf);
cons_cell* create_pf(cons_cell* attr, cons_cell* next_attr);
cons_cell* create_table(char *table);
cons_cell* create_term(char *term);
cons_cell* create_col(char *col);
cons_cell* create_attr(char *attr);
cons_cell* create_var(char *var);
cons_cell* create_comp_operator(char* op, cons_cell* term1, cons_cell* term2, cons_cell* ra);
cons_cell* create_atom_operator(char* tab_name, char* var);
cons_cell* create_union_all_operator(cons_cell* ra1, cons_cell* ra2);
cons_cell* create_cross_operator(cons_cell* ra1, cons_cell* ra2);
cons_cell* create_assign_operator(char* original, char* new_name, cons_cell* next);
cons_cell* create_proj_operator(cons_cell* assign, cons_cell* ra);
cons_cell* create_not_operator(cons_cell* ra1, cons_cell* ra2);
cons_cell* create_limit_operator(cons_cell* ra1, cons_cell* ra2);
cons_cell* create_elim_operator(cons_cell* ra1, cons_cell* ra2);
cons_cell* create_eval_operator(cons_cell* logic, cons_cell* cross);
struct node *new_node(int count, int type);
void translate(struct linked_node *linked_tree, struct node *tree);
void print_cons_tree(cons_cell *root, int indent);
void print_tree(struct node *root, int indent);
void print_linked_tree(struct linked_node *root, int indent);
void destroy_tree(struct node *root);
......
No preview for this file type
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