%{ #include #define YYERROR_VERBOSE extern int yyline; extern char yytext[]; %} %token V_INT ID %% program :declarations /* |code */ ; declarations :decl_var /* |decl_const |decl_main |decl_func */ ; decl_var :type_var list_var ';' ; list_var :ID |list_var ',' ID ; type_var :V_INT /* |V_CHAR |V_FLOAT */ ; %% main () { while (1) yyparse (); } yyerror(s) char *s; { fprintf (stderr, "%s\n", s); }