Remove building with NOCRYPTO option
[minix3.git] / external / bsd / byacc / dist / test / btyacc_destroy3.y
blobc21fdaf8d4f27c56cdf4ab024c3bbeb162aecafb
1 /* $NetBSD: btyacc_destroy3.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */
3 %parse-param {
4 struct parser_param *param,
5 int flag
8 %{
9 #include <stdlib.h>
11 typedef enum {cGLOBAL, cLOCAL} class;
12 typedef enum {tREAL, tINTEGER} type;
13 typedef char * name;
15 struct symbol { class c; type t; name id; };
16 typedef struct symbol symbol;
18 struct namelist { symbol *s; struct namelist *next; };
19 typedef struct namelist namelist;
21 struct parser_param {
22 int *rtrn;
23 symbol ss;
26 extern symbol *mksymbol(type t, class c, name id);
28 #ifdef YYBISON
29 #define YYLEX_DECL() yylex(void)
30 #define YYERROR_DECL() yyerror(const char *s)
31 #endif
34 %token <cval> GLOBAL LOCAL
35 %token <tval> REAL INTEGER
36 %token <id> NAME
38 %type <nlist> declaration
39 %type <nlist> locnamelist
40 %type <cval> class
41 %type <tval> type
42 %type <nlist> namelist
44 %destructor { if (!param->rtrn) close($$); } <file>
46 %destructor {
47 namelist *p = $$;
48 while (p != NULL)
49 { namelist *pp = p;
50 p = p->next;
51 free(pp->s); free(pp);
53 } declaration
55 %union
57 class cval;
58 type tval;
59 namelist * nlist;
60 name id;
63 %start declaration
66 declaration: class type namelist'(' class ',' type ')'
67 { $$ = $3; }
68 | type locnamelist '(' class ')'
69 { $$ = $2; }
72 class : GLOBAL { $$ = cGLOBAL; }
73 | LOCAL { $$ = cLOCAL; }
76 type : REAL { $$ = tREAL; }
77 | INTEGER { $$ = tINTEGER; }
80 namelist: namelist NAME
81 { $$->s = mksymbol($<tval>0, $<cval>0, $2);
82 $$->next = $1;
84 | NAME
85 { $$->s = mksymbol(0, 0, $1);
86 $$->next = NULL;
90 locnamelist: namelist '(' LOCAL ',' type ')'
91 { $$ = $1; }
95 extern int YYLEX_DECL();
96 extern void YYERROR_DECL();