Remove building with NOCRYPTO option
[minix3.git] / external / bsd / byacc / dist / test / inherit1.y
blobe8db9cdd4c532140c9026b513bc54ca4682fc20f
1 /* $NetBSD: inherit1.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */
3 %{
4 #include <stdlib.h>
6 typedef enum {cGLOBAL, cLOCAL} class;
7 typedef enum {tREAL, tINTEGER} type;
8 typedef char * name;
10 struct symbol { class c; type t; name id; };
11 typedef struct symbol symbol;
13 struct namelist { symbol *s; struct namelist *next; };
14 typedef struct namelist namelist;
16 extern symbol *mksymbol(type t, class c, name id);
18 #ifdef YYBISON
19 #define YYLEX_DECL() yylex(void)
20 #define YYERROR_DECL() yyerror(const char *s)
21 extern int YYLEX_DECL();
22 extern void YYERROR_DECL();
23 #endif
26 %token <cval> GLOBAL LOCAL
27 %token <tval> REAL INTEGER
28 %token <id> NAME
30 %type <nlist> declaration namelist locnamelist
31 %type <cval> class
32 %type <tval> type
34 %union
36 class cval;
37 type tval;
38 namelist * nlist;
39 name id;
42 %start declaration
45 declaration: class type namelist
46 { $$ = $3; }
47 | type locnamelist
48 { $$ = $2; }
51 class : GLOBAL { $$ = cGLOBAL; }
52 | LOCAL { $$ = cLOCAL; }
55 type : REAL { $$ = tREAL; }
56 | INTEGER { $$ = tINTEGER; }
59 namelist: namelist NAME
60 { $$->s = mksymbol($<tval>0, $<cval>-1, $2);
61 $$->next = $1;
63 | NAME
64 { $$->s = mksymbol($<tval>0, $<cval>-1, $1);
65 $$->next = NULL;
69 locnamelist:
70 { $<cval>$ = cLOCAL; } /* set up semantic stack for <class> = LOCAL */
71 { $<tval>$ = $<tval>-1; } /* copy <type> to where <namelist> expects it */
72 namelist
73 { $$ = $3; }
77 extern int YYLEX_DECL();
78 extern void YYERROR_DECL();