%{ #include #include #include "Assign6-solution.tab.h" extern int linecount; %} %% program return PROGRAM; end return END; variables return VARIABLES; var return VAR; functions return FUNCTIONS; define return DEFINE; statements return STATEMENTS; if return IF; then return THEN; else return ELSE; while return WHILE; , return COMMA; "(" return LPARENTHESIS; ")" return RPARENTHESIS; "{" return LBRACE; "}" return RBRACE; : return COLON; ; return SEMICOLON; [a-zA-Z0-9]+ yylval = (int)strdup(yytext); return ID; [\n] linecount++; [ \t]+