4 typedef enum {cGLOBAL, cLOCAL} class;
5 typedef enum {tREAL, tINTEGER} type;
8 struct symbol { class c; type t; name id; };
9 typedef struct symbol symbol;
11 struct namelist { symbol *s; struct namelist *next; };
12 typedef struct namelist namelist;
14 extern symbol *mksymbol(type t, class c, name id);
17 #define YYLEX_DECL() yylex(void)
18 #define YYERROR_DECL() yyerror(const char *s)
22 %token <cval> GLOBAL LOCAL
23 %token <tval> REAL INTEGER
26 %type <nlist> declaration namelist(<cval>, <tval>) locnamelist(<tval>)
35 free(pp->s); free(pp);
50 declaration: class type namelist($1, $2)
52 | type locnamelist($1)
56 class : GLOBAL { $$ = cGLOBAL; }
57 | LOCAL { $$ = cLOCAL; }
60 type : REAL { $$ = tREAL; }
61 | INTEGER { $$ = tINTEGER; }