1 %parse-param { struct parser_param *param } { int flag }
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;
21 extern symbol *mksymbol(type t, class c, name id);
24 #define YYLEX_DECL() yylex(void)
25 #define YYERROR_DECL() yyerror(const char *s)
29 %token <cval> GLOBAL LOCAL
30 %token <tval> REAL INTEGER
33 %type <nlist> declaration
34 %type <nlist> locnamelist
37 %type <nlist> namelist
39 %destructor { if (!param->rtrn) close($$); } <file>
46 free(pp->s); free(pp);
61 declaration: class type namelist'(' class ',' type ')'
63 | type locnamelist '(' class ')'
67 class : GLOBAL { $$ = cGLOBAL; }
68 | LOCAL { $$ = cLOCAL; }
71 type : REAL { $$ = tREAL; }
72 | INTEGER { $$ = tINTEGER; }
75 namelist: namelist NAME
76 { $$->s = mksymbol($<tval>0, $<cval>0, $2);
80 { $$->s = mksymbol(0, 0, $1);
85 locnamelist: namelist '(' LOCAL ',' type ')'
90 extern int YYLEX_DECL();
91 extern void YYERROR_DECL();