xref: /minix3/external/bsd/byacc/dist/test/code_debug.y (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc /*	$NetBSD: code_debug.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $	*/
2*0a6a1f1dSLionel Sambuc 
3*0a6a1f1dSLionel Sambuc %{
4*0a6a1f1dSLionel Sambuc 
5*0a6a1f1dSLionel Sambuc #ifdef YYBISON
6*0a6a1f1dSLionel Sambuc int yylex(void);
7*0a6a1f1dSLionel Sambuc static void yyerror(const char *);
8*0a6a1f1dSLionel Sambuc #endif
9*0a6a1f1dSLionel Sambuc 
10*0a6a1f1dSLionel Sambuc %}
11*0a6a1f1dSLionel Sambuc %%
12*0a6a1f1dSLionel Sambuc S: error
13*0a6a1f1dSLionel Sambuc %%
14*0a6a1f1dSLionel Sambuc 
15*0a6a1f1dSLionel Sambuc #include <stdio.h>
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc #ifdef YYBYACC
18*0a6a1f1dSLionel Sambuc extern int YYLEX_DECL();
19*0a6a1f1dSLionel Sambuc #endif
20*0a6a1f1dSLionel Sambuc 
21*0a6a1f1dSLionel Sambuc int
main(void)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