1/*	$NetBSD: inherit0.y,v 1.1.1.3 2016/01/09 21:59:45 christos Exp $	*/
2
3%{
4extern void mksymbol(int t, int c, int id);
5
6#ifdef YYBISON
7#define YYLEX_DECL() yylex(void)
8#define YYERROR_DECL() yyerror(const char *s)
9extern int YYLEX_DECL();
10extern void YYERROR_DECL();
11#endif
12%}
13
14%token GLOBAL LOCAL
15%token REAL INTEGER
16%token NAME
17
18%start declaration
19
20%%
21declaration: class type namelist
22	{ $$ = $3; }
23	| type locnamelist
24	{ $$ = $2; }
25	;
26
27class	: GLOBAL { $$ = 1; }
28	| LOCAL  { $$ = 2; }
29	;
30
31type	: REAL    { $$ = 1; }
32	| INTEGER { $$ = 2; }
33	;
34
35namelist: namelist NAME
36	    { mksymbol($0, $-1, $2); }
37	| NAME
38	    { mksymbol($0, $-1, $1); }
39	;
40
41locnamelist:
42	{ $$ = 2; }   /* set up semantic stack for <class>: LOCAL */
43	{ $$ = $-1; } /* copy <type> to where <namelist> expects it */
44	namelist
45	{ $$ = $3; }
46	;
47%%
48
49extern int YYLEX_DECL();
50extern void YYERROR_DECL();
51