Remove building with NOCRYPTO option
[minix3.git] / external / bsd / byacc / dist / test / err_inherit4.y
blob64cf39443f5252bba9bc6063b7adcf5f67469058
1 /* $NetBSD: err_inherit4.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */
3 %locations
4 %{
5 #include <stdlib.h>
7 typedef enum {cGLOBAL, cLOCAL} class;
8 typedef enum {tREAL, tINTEGER} type;
9 typedef char * name;
11 struct symbol { class c; type t; name id; };
12 typedef struct symbol symbol;
14 struct namelist { symbol *s; struct namelist *next; };
15 typedef struct namelist namelist;
17 extern symbol *mksymbol(type t, class c, name id);
19 #ifdef YYBISON
20 #define YYLEX_DECL() yylex(void)
21 #define YYERROR_DECL() yyerror(const char *s)
22 #endif
25 %token <cval> GLOBAL LOCAL
26 %token <tval> REAL INTEGER
27 %token <id> NAME
29 %type <nlist> declaration namelist(<cval>, <tval>) locnamelist(<tval>)
30 %destructor { } <nlist>
31 %type <cval> class
32 %type <tval> type
34 %destructor {
35 namelist *p = $$;
36 while (p != NULL)
37 { namelist *pp = p;
38 p = p->next;
39 free(pp->s); free(pp);
41 } <nlist>
43 %union
45 class cval;
46 type tval;
47 namelist * nlist;
48 name id;
51 %start declaration
54 declaration: class type namelist($1, $2)
55 { $$ = $3; }
56 | type locnamelist($1)
57 { $$ = $2; }
60 class : GLOBAL { $$ = cGLOBAL; }
61 | LOCAL { $$ = cLOCAL; }
64 type : REAL { $$ = tREAL; }
65 | INTEGER { $$ = tINTEGER; }
68 namelist($c, $t): namelist NAME
69 { $$->s = mksymbol($t, $c, $2);
70 $$->next = $1;
72 | NAME
73 { $$->s = mksymbol($t, $c, $1);
74 $$->next = NULL;
78 locnamelist($t): namelist
79 { $$ = $1; @$ = @2; }
83 extern int YYLEX_DECL();
84 extern void YYERROR_DECL();