1 /* $NetBSD: err_syntax25.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 %union { 14 int ival2; 15 double dval2; 16 } 17 18 %start expr 19 %type <tag2> expr 20 21 %token NUMBER 22 23 %% 24 25 expr : '(' recur ')' 26 ; 27 28 recur : NUMBER 29 { $$ = 1; } 30 ; 31 32 %% 33 34 #include <stdio.h> 35 36 int 37 main(void) 38 { 39 printf("yyparse() = %d\n", yyparse()); 40 return 0; 41 } 42 43 int yylex(void)44yylex(void) 45 { 46 return -1; 47 } 48 49 static void yyerror(const char * s)50yyerror(const char* s) 51 { 52 printf("%s\n", s); 53 } 54