Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %{
- #include <stdio.h>
- #include "crud.h" // my header file
- extern FILE* yyin;
- databasePtr root = NULL;
- %}
- %token R_OP_1 R_OP_2 EQ INSERT INTO VALUES CREATE DEFAULT PRIMARY KEY NOT NONE
- %union{
- struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
- }
- %token <db_object> TABLE ID TYPE_SPECIFIER LITERAL
- %type <db_object> CREATE_TABLE CONSTRAINT CONSTRAINTS ATTR_LIST COL_LIST VAL_LIST
- %%
- ..
- ..
- CC=cc
- all:parser
- y.tab.c y.tab.h: sql_parser.y
- yacc -d sql_parser.y
- lex.yy.c:sql_lexer.l y.tab.h
- lex sql_lexer.l
- parser: lex.yy.c y.tab.c crud.c
- $(CC) -o parser y.tab.c lex.yy.c crud.c -ly -ll -w
- clean:
- rm -f *.o parser lex.yy.c y.tab.c y.tab.h
- yacc -d sql_parser.y
- lex sql_lexer.l
- cc -o parser y.tab.c lex.yy.c crud.h crud.c -ly -ll -w
- In file included from sql_lexer.l:2:0:
- sql_parser.y:11:12: error: unknown type name ‘tablePtr’
- struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
- ^~~~~~~~
- sql_parser.y:11:52: error: unknown type name ‘attrPtr’
- struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
- ^~~~~~~
- sql_parser.y:11:68: error: unknown type name ‘listPtr’
- struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
- ^~~~~~~
- Makefile:12: recipe for target 'parser' failed
- make: *** [parser] Error 1
Add Comment
Please, Sign In to add comment