#include #include "ubf_a.h" /* global for relaying a term from bison parser */ /* XXX - look into bison's "Pure Parsers" for re-entrant solution */ #include "u.tab.h" int yylex(YYSTYPE *lvalp); int yyparse(void *yvalp); int main (void) { int i; int r; /* bison mallocs the term content and sets a pointer to it */ ubfa_term_t * u; for (i = 0;;i++) { r = yyparse ((void *)(&u)); printf("main - parse item %02d returned %d\n", i, r); if (r == 0) { ubfa_print(u); /* to do - free up u's heap space */ } if (r < 0) break; } } #if 0 void yyerror (const char *s) /* Called by yyparse on error */ { printf ("%s\n", s); } #endif