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