fork(1) download
  1. %{
  2. #include "y.tab.h";
  3. extern intyylval;
  4. %}
  5. %%
  6. [0-9]+{n = atoi(yytext)
  7. return num;}
  8. \n return 0;
  9. %%
  10. %{
  11. #include<stdio.h>
  12. int t,r,n,x;
  13. %}
  14. %token num;
  15. %%
  16. state:num{x=$1;
  17. t=1;
  18. n=0;
  19. while(x!=0){
  20. r=n%s;
  21. n=n+r*t;
  22. t=t*10;
  23. x=x%8;
  24. }
  25. printf("%d",n)
  26. }
  27. void yyerror (char*s)
  28. {
  29. Printf("syntax error");
  30. }
  31. int main(){
  32. return yyparse();}
  33.  
  34.  
  35.  
Success #stdin #stdout #stderr 0.03s 6868KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/di5cZX/prog:34:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit