fork download
  1. %{
  2.  
  3. #include <stdio.h>
  4.  
  5. %}
  6.  
  7.  
  8.  
  9. %%
  10.  
  11.  
  12.  
  13. [0-9]+\.[0-9]+ {
  14.  
  15. double float_num = atof(yytext);
  16.  
  17. int int_part = (int)float_num;
  18.  
  19. printf("%d\n", int_part);
  20.  
  21. }
  22.  
  23.  
  24.  
  25. .|\n ; // Ignore any other characters
  26.  
  27.  
  28.  
  29. %%
  30.  
  31.  
  32.  
  33. int yywrap() {
  34.  
  35. return 1;
  36.  
  37. }
  38.  
  39.  
  40.  
  41. int main() {
  42.  
  43. yylex();
  44.  
  45. return 0;
  46.  
  47. }
  48.  
  49.  
Success #stdin #stdout #stderr 0.02s 6856KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/kKdFpS/prog:48:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit