fork download
  1. %{
  2. #include<stdio.h>
  3. int fact = 1,num;
  4. %}
  5. %%
  6. [0-9]+
  7. {
  8. num = atoi(yytext);
  9. while (num > 1)
  10. fact *= num--;
  11. printf ("Factorial is = %d",fact);
  12. return(0);
  13. }
  14. %%
  15. main()
  16. {
  17. printf ("Enter the number - ");
  18. yylex();
  19. }
Success #stdin #stdout #stderr 0.03s 6804KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/WL1zmR/prog:19:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit