xref: /freebsd/contrib/byacc/test/err_syntax23.y (revision e0c4386e)
1 %{
2 int yylex(void);
3 static void yyerror(const char *);
4 %}
5 
6 %union {
7 	int ival;
8 	double dval;
9 }
10 
11 %type <tag2> recur
12 
13 %token NUMBER
14 
15 %%
16 
17 expr  :  '(' recur ')'
18 	{ $$ = $2; }
19       ;
20 
21 recur :  NUMBER
22 	{ $$ = 1; }
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
37 yylex(void)
38 {
39     return -1;
40 }
41 
42 static void
43 yyerror(const char* s)
44 {
45     printf("%s\n", s);
46 }
47