1%{ 2 3#ifdef YYBISON 4#define YYSTYPE int 5#define YYLEX_PARAM &yylval 6#define YYLEX_DECL() yylex(YYSTYPE *yylval) 7#define YYERROR_DECL() yyerror(const char *s) 8int YYLEX_DECL(); 9static void YYERROR_DECL(); 10#endif 11 12%} 13 14%% 15S: error 16%% 17 18#include <stdio.h> 19 20#ifdef YYBYACC 21extern int YYLEX_DECL(); 22#endif 23 24int 25main(void) 26{ 27 printf("yyparse() = %d\n", yyparse()); 28 return 0; 29} 30 31int 32yylex(YYSTYPE *value) 33{ 34 return value ? 0 : -1; 35} 36 37static void 38yyerror(const char* s) 39{ 40 printf("%s\n", s); 41} 42