xref: /netbsd-src/external/bsd/byacc/dist/test/err_syntax23.y (revision eceb233b9bd0dfebb902ed73b531ae6964fa3f9b)
1 /*	$NetBSD: err_syntax23.y,v 1.1.1.3 2016/01/09 21:59:45 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 %type <tag2> recur
14 
15 %token NUMBER
16 
17 %%
18 
19 expr  :  '(' recur ')'
20 	{ $$ = $2; }
21       ;
22 
23 recur :  NUMBER
24 	{ $$ = 1; }
25       ;
26 
27 %%
28 
29 #include <stdio.h>
30 
31 int
32 main(void)
33 {
34     printf("yyparse() = %d\n", yyparse());
35     return 0;
36 }
37 
38 int
39 yylex(void)
40 {
41     return -1;
42 }
43 
44 static void
45 yyerror(const char* s)
46 {
47     printf("%s\n", s);
48 }
49