Advertisement
Binkol

tablice2.flex

Jan 22nd, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. %option noyywrap
  2.  
  3. %{
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. %}
  7.  
  8. nazw [a-zA-z]([a-zA-Z0-9_]*)
  9. liczb [0-9]+
  10.  
  11. %%
  12.  
  13. [\n\;\*\,\[\]] {
  14. return *yytext;
  15. }
  16.  
  17. [ \t] { }
  18.  
  19. "char" {
  20. return CHAR;
  21. }
  22. "int" {
  23. return INT;
  24. }
  25. "float" {
  26. return FLOAT;
  27. }
  28. "double" {
  29. return DOUBLE;
  30. }
  31.  
  32. {nazw} {
  33. yylval.tekst = strdup(yytext);
  34. return NAZWA;
  35. }
  36.  
  37. {liczb} {
  38. yylval.numer = atoi(yytext);
  39. return ROZMIAR;
  40. }
  41.  
  42. %%
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement