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