scanner.flex 325 B

12345678910111213141516171819202122232425
  1. %{
  2. // HEADERS
  3. #include <stdlib.h>
  4. #include "parser.h"
  5. // variables maintained by the lexical analyser
  6. int yyline = 1;
  7. %}
  8. %option noyywrap
  9. %%
  10. [ \t]+ { }
  11. #.*\n { yyline++; }
  12. \n { yyline++; }
  13. \-?[0-9]+ {
  14. yylval.intValue = atoi(yytext);
  15. return INT;
  16. }
  17. "+" { return PLUS; }
  18. . { yyerror("unexpected character"); }
  19. %%