Remove building with NOCRYPTO option
[minix3.git] / external / bsd / byacc / dist / test / btyacc_destroy2.y
blob28e2b55752cc75f1d8c73be11d5b66c813c3da23
1 /* $NetBSD: btyacc_destroy2.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */
3 %parse-param { struct parser_param *param } { int flag }
5 %{
6 #include <stdlib.h>
8 typedef enum {cGLOBAL, cLOCAL} class;
9 typedef enum {tREAL, tINTEGER} type;
10 typedef char * name;
12 struct symbol { class c; type t; name id; };
13 typedef struct symbol symbol;
15 struct namelist { symbol *s; struct namelist *next; };
16 typedef struct namelist namelist;
18 struct parser_param {
19 int *rtrn;
20 symbol ss;
23 extern symbol *mksymbol(type t, class c, name id);
25 #ifdef YYBISON
26 #define YYLEX_DECL() yylex(void)
27 #define YYERROR_DECL() yyerror(const char *s)
28 #endif
31 %token <cval> GLOBAL LOCAL
32 %token <tval> REAL INTEGER
33 %token <id> NAME
35 %type <nlist> declaration
36 %type <nlist> locnamelist
37 %type <cval> class
38 %type <tval> type
39 %type <nlist> namelist
41 %destructor { if (!param->rtrn) close($$); } <file>
43 %destructor {
44 namelist *p = $$;
45 while (p != NULL)
46 { namelist *pp = p;
47 p = p->next;
48 free(pp->s); free(pp);
50 } declaration
52 %union
54 class cval;
55 type tval;
56 namelist * nlist;
57 name id;
60 %start declaration
63 declaration: class type namelist'(' class ',' type ')'
64 { $$ = $3; }
65 | type locnamelist '(' class ')'
66 { $$ = $2; }
69 class : GLOBAL { $$ = cGLOBAL; }
70 | LOCAL { $$ = cLOCAL; }
73 type : REAL { $$ = tREAL; }
74 | INTEGER { $$ = tINTEGER; }
77 namelist: namelist NAME
78 { $$->s = mksymbol($<tval>0, $<cval>0, $2);
79 $$->next = $1;
81 | NAME
82 { $$->s = mksymbol(0, 0, $1);
83 $$->next = NULL;
87 locnamelist: namelist '(' LOCAL ',' type ')'
88 { $$ = $1; }
92 extern int YYLEX_DECL();
93 extern void YYERROR_DECL();