%{ #include #include "internals.h" int yylex(void); void yyerror(char *); extern int yylineno; %} %token EQUAL %token NEWLINE %token NUMBER %token STRING %token IDENTIFIER %union { int Number; char String[5000]; } %% Config: Configline Config { } | ; Configline: Numberline NEWLINE | Stringline NEWLINE | NEWLINE; Numberline: IDENTIFIER EQUAL NUMBER { setIValue($1,$3); } ; Stringline: IDENTIFIER EQUAL STRING { setSValue($1,$3); } ; %% void yyerror(char *s) { fprintf(stderr, "%s line %d\n", s, yylineno); }