Five_NT

limbaj.l

Dec 28th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. %{
  2. #include <stdio.h>
  3. #include "y.tab.h"
  4. #include <string.h>
  5. %}
  6. %%
  7. "var"|"int" {return TIP;}
  8. "fct_begin" {return BGINF;}
  9. "fct_end" {return ENDF;}
  10. "=" {return EGAL;}
  11. "+" {return PLUS;}
  12. "-" {return MINUS;}
  13. "*" {return INM;}
  14. "/" {return IMP;}
  15. "mod" {return MOD;}
  16. "print" {return PRINT;}
  17. [_a-zA-Z][_a-zA-Z0-9]*  {return ID;}
  18. "-"?[1-9][0-9]* {return NR;}
  19.  
  20. [ \t] ;
  21. \n {yylineno++;}
  22. . {return yytext[0];}
Add Comment
Please, Sign In to add comment