xref: /minix3/external/bsd/byacc/dist/test/err_syntax20.y (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: err_syntax20.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $	*/
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc %{
4*0a6a1f1dSLionel Sambuc int yylex(void);
5*0a6a1f1dSLionel Sambuc static void yyerror(const char *);
6*0a6a1f1dSLionel Sambuc %}
7*0a6a1f1dSLionel Sambuc 
8*0a6a1f1dSLionel Sambuc %type <check> expr
9*0a6a1f1dSLionel Sambuc %type <rechk> recur
10*0a6a1f1dSLionel Sambuc 
11*0a6a1f1dSLionel Sambuc %%
12*0a6a1f1dSLionel Sambuc 
13*0a6a1f1dSLionel Sambuc expr  :  '(' recur ')'
14*0a6a1f1dSLionel Sambuc 	{ $2 = 3; }
15*0a6a1f1dSLionel Sambuc       ;
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc %%
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc #include <stdio.h>
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc int
22*0a6a1f1dSLionel Sambuc main(void)
23*0a6a1f1dSLionel Sambuc {
24*0a6a1f1dSLionel Sambuc     printf("yyparse() = %d\n", yyparse());
25*0a6a1f1dSLionel Sambuc     return 0;
26*0a6a1f1dSLionel Sambuc }
27*0a6a1f1dSLionel Sambuc 
28*0a6a1f1dSLionel Sambuc int
yylex(void)29*0a6a1f1dSLionel Sambuc yylex(void)
30*0a6a1f1dSLionel Sambuc {
31*0a6a1f1dSLionel Sambuc     return -1;
32*0a6a1f1dSLionel Sambuc }
33*0a6a1f1dSLionel Sambuc 
34*0a6a1f1dSLionel Sambuc static void
yyerror(const char * s)35*0a6a1f1dSLionel Sambuc yyerror(const char* s)
36*0a6a1f1dSLionel Sambuc {
37*0a6a1f1dSLionel Sambuc     printf("%s\n", s);
38*0a6a1f1dSLionel Sambuc }
39