1*84d9c625SLionel Sambuc /* $NetBSD: code_error.y,v 1.1.1.4 2013/04/06 14:45:29 christos Exp $ */ 24a17663cSThomas Veerman 3*84d9c625SLionel Sambuc %{ 4*84d9c625SLionel Sambuc 5*84d9c625SLionel Sambuc #ifdef YYBISON 6*84d9c625SLionel Sambuc int yylex(void); 7*84d9c625SLionel Sambuc static void yyerror(const char *); 8*84d9c625SLionel Sambuc #endif 9*84d9c625SLionel Sambuc 10*84d9c625SLionel Sambuc %} 114a17663cSThomas Veerman %% 124a17663cSThomas Veerman S: error 134a17663cSThomas Veerman %% 144a17663cSThomas Veerman 154a17663cSThomas Veerman #include <stdio.h> 164a17663cSThomas Veerman 174a17663cSThomas Veerman #ifdef YYBYACC 184a17663cSThomas Veerman extern int YYLEX_DECL(); 194a17663cSThomas Veerman #endif 204a17663cSThomas Veerman 214a17663cSThomas Veerman int main(void)224a17663cSThomas Veermanmain(void) 234a17663cSThomas Veerman { 244a17663cSThomas Veerman printf("yyparse() = %d\n", yyparse()); 254a17663cSThomas Veerman return 0; 264a17663cSThomas Veerman } 274a17663cSThomas Veerman 284a17663cSThomas Veerman int yylex(void)294a17663cSThomas Veermanyylex(void) 304a17663cSThomas Veerman { 314a17663cSThomas Veerman return -1; 324a17663cSThomas Veerman } 334a17663cSThomas Veerman 344a17663cSThomas Veerman static void yyerror(const char * s)354a17663cSThomas Veermanyyerror(const char* s) 364a17663cSThomas Veerman { 374a17663cSThomas Veerman printf("%s\n", s); 384a17663cSThomas Veerman } 39