fork download
  1. %{
  2. #include <stdio.h>
  3. int num;
  4. %}
  5.  
  6. %%
  7.  
  8. [0-9]+ {
  9. num = atoi(yytext);
  10. printf("Multiplication Table of %d:\n", num);
  11.  
  12. for(int i = 1; i <= 10; i++) {
  13. printf("%d x %d = %d\n", num, i, num*i);
  14. }
  15. }
  16.  
  17. \n ;
  18.  
  19. %%
  20.  
  21. int yywrap() {
  22. return 1;
  23. }
  24.  
  25. int main() {
  26. printf("Enter a number: ");
  27. yylex();
  28. return 0;
  29. }
Success #stdin #stdout #stderr 0.02s 6908KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/SLEXvn/prog:29:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit