1 /* $NetBSD: err_syntax22.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */ 2 3 %{ 4 int yylex(void); 5 static void yyerror(const char *); 6 %} 7 8 %union { 9 int ival; 10 double dval; 11 } 12 13 %token NUMBER 14 %type <dval> expr 15 16 %% 17 18 expr : '(' recur ')' 19 { foo( $$ = $2 ); } 20 ; 21 22 recur : NUMBER 23 ; 24 25 %% 26 27 #include <stdio.h> 28 29 int 30 main(void) 31 { 32 printf("yyparse() = %d\n", yyparse()); 33 return 0; 34 } 35 36 int yylex(void)37yylex(void) 38 { 39 return -1; 40 } 41 42 static void yyerror(const char * s)43yyerror(const char* s) 44 { 45 printf("%s\n", s); 46 } 47