1 /* $NetBSD: err_inherit1.y,v 1.1.1.1 2015/01/03 22:58:23 christos Exp $ */
6 typedef
enum {cGLOBAL
, cLOCAL
} class
;
7 typedef
enum {tREAL
, tINTEGER
} type
;
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
);
19 #define YYLEX_DECL() yylex(void)
20 #define YYERROR_DECL() yyerror(const char *s)
24 %token
<cval
> GLOBAL LOCAL
25 %token
<tval
> REAL INTEGER
28 %type
<nlist
> declaration namelist
(<cval
>, <tval
>) locnamelist
(<tval
>)
37 free
(pp
->s
); free
(pp
);
52 declaration: class type namelist
($1, $2)
54 | type locnamelist
($1)
58 class
: GLOBAL
{ $$
= cGLOBAL
; }
59 | LOCAL
{ $$
= cLOCAL
; }
62 type
: REAL
{ $$
= tREAL
; }
63 | INTEGER
{ $$
= tINTEGER
; }