%{ #include #include %} /* add: token, precedence, types etc. */ %token ASSIGN %% /* rules */ /* Notice: use empty action { } for rules with typed tokens * to avoid type conflicts */ %% #include "lex.yy.c" int main(int argc,char *argv[]) { char *result; result = (char *) yyparse(); return(1); } /* * yyerror - returns error msg "err" and line number */ int yyerror(char *err) { fprintf(stderr, "%s in line %d at %s\n", err, yylineno, yytext); }