Guest User

Untitled

a guest
Oct 20th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. %{
  2. #include <stdio.h>
  3. #include "crud.h" // my header file
  4. extern FILE* yyin;
  5. databasePtr root = NULL;
  6. %}
  7.  
  8. %token R_OP_1 R_OP_2 EQ INSERT INTO VALUES CREATE DEFAULT PRIMARY KEY NOT NONE
  9.  
  10. %union{
  11. struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
  12. }
  13. %token <db_object> TABLE ID TYPE_SPECIFIER LITERAL
  14. %type <db_object> CREATE_TABLE CONSTRAINT CONSTRAINTS ATTR_LIST COL_LIST VAL_LIST
  15.  
  16. %%
  17. ..
  18. ..
  19.  
  20. CC=cc
  21.  
  22. all:parser
  23.  
  24. y.tab.c y.tab.h: sql_parser.y
  25. yacc -d sql_parser.y
  26.  
  27. lex.yy.c:sql_lexer.l y.tab.h
  28. lex sql_lexer.l
  29.  
  30. parser: lex.yy.c y.tab.c crud.c
  31. $(CC) -o parser y.tab.c lex.yy.c crud.c -ly -ll -w
  32.  
  33. clean:
  34. rm -f *.o parser lex.yy.c y.tab.c y.tab.h
  35.  
  36. yacc -d sql_parser.y
  37. lex sql_lexer.l
  38. cc -o parser y.tab.c lex.yy.c crud.h crud.c -ly -ll -w
  39. In file included from sql_lexer.l:2:0:
  40. sql_parser.y:11:12: error: unknown type name ‘tablePtr’
  41. struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
  42. ^~~~~~~~
  43. sql_parser.y:11:52: error: unknown type name ‘attrPtr’
  44. struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
  45. ^~~~~~~
  46. sql_parser.y:11:68: error: unknown type name ‘listPtr’
  47. struct s {tablePtr m_table; int type; char* name; attrPtr m_attr; listPtr m_list;} db_object;
  48. ^~~~~~~
  49. Makefile:12: recipe for target 'parser' failed
  50. make: *** [parser] Error 1
Add Comment
Please, Sign In to add comment