xref: /freebsd/contrib/byacc/test/err_syntax25.y (revision 81ad6265)
1 %{
2 int yylex(void);
3 static void yyerror(const char *);
4 %}
5 
6 %union {
7 	int ival;
8 	double dval;
9 }
10 
11 %union {
12 	int ival2;
13 	double dval2;
14 }
15 
16 %start expr
17 %type <tag2> expr
18 
19 %token NUMBER
20 
21 %%
22 
23 expr  :  '(' recur ')'
24       ;
25 
26 recur :  NUMBER
27 	{ $$ = 1; }
28       ;
29 
30 %%
31 
32 #include <stdio.h>
33 
34 int
35 main(void)
36 {
37     printf("yyparse() = %d\n", yyparse());
38     return 0;
39 }
40 
41 int
42 yylex(void)
43 {
44     return -1;
45 }
46 
47 static void
48 yyerror(const char* s)
49 {
50     printf("%s\n", s);
51 }
52