Guest User

Untitled

a guest
Apr 25th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. %{
  2.  
  3. #include<stdio.h>
  4. #include<stdlib.h>
  5. int suma=0, i=0;
  6. char pom;
  7.  
  8. %}
  9.  
  10. CISLA [0-9]
  11. PRAZDNY [ \t\n\r]
  12.  
  13. %%
  14.  
  15. ^{CISLA}+{PRAZDNY}+ {suma = yyleng-1;
  16. for (i=0;i< (suma/2);i++) {
  17. pom = yytext[i];
  18. yytext[i] = yytext[suma-i-1];
  19. yytext[suma-1-i] = pom;
  20. }
  21. printf("%s", yytext);
  22. yyless(yyleng - 1);
  23. }
  24. ^{PRAZDNY}+{CISLA}+{PRAZDNY}+ {
  25. suma = yyleng-1;
  26. for (i=0;i< (suma/2);i++) {
  27. pom = yytext[i];
  28. yytext[i] = yytext[suma-i-1];
  29. yytext[suma-1-i] = pom;
  30. }
  31. printf("%s", yytext);
  32. yyless(yyleng - 1);
  33. }
  34. .
  35.  
  36. %%
  37.  
  38. main (int argc, char **argv)
  39. {
  40. yylex();
  41. }
Add Comment
Please, Sign In to add comment