fork download
  1. %{
  2. #include<stdio.h> int
  3. c=0,bc=0,fc=0;
  4. FILE *fp;
  5. %}
  6. %s IF OPENP CLOSEP OPENF
  7. %%
  8. \n { c++; }
  9. "if" {BEGIN IF;ECHO;bc=0;}
  10. <IF>\n {c++;ECHO;printf("\n");}
  11. <IF>"(" {BEGIN OPENP;ECHO;bc++;}
  12. <IF>")" {BEGIN CLOSEP;ECHO;bc--;}
  13. <OPENP>")" {ECHO;bc--;BEGIN CLOSEP;}
  14. <OPENP>"(" {ECHO;bc++;}
  15. <OPENP>. {ECHO;}
  16. <CLOSEP>"{" {if(bc==0) {printf("condn is valid in line no %d\n",c+1);} else
  17. printf("condn invalid in line no %d;Paranthesis mismatch in condn\n",c+1);
  18. BEGIN OPENF;ECHO;printf("\n");fc++;}
  19. <CLOSEP>"(" {BEGIN OPENP;bc++;ECHO;}
  20. <CLOSEP>")" {ECHO;bc--;}
  21. <CLOSEP>. {ECHO;}
  22. <CLOSEP>\n {ECHO;printf("\n");c++;}
  23. <OPENF>"}" {fc--;if(fc==0) BEGIN 0;;ECHO;printf("\n");}
  24. <OPENF>. {ECHO;}
  25. <OPENF>\n {ECHO;c++;}
  26. .|\n ; %% main() {
  27. yyin=fopen("source.txt","r"); yylex();
  28. fclose(yyin);
  29. }
Success #stdin #stdout #stderr 0.02s 6880KB
stdin
#include<stdio.h>
#include<conio.h
> 
#include<string.h 
> void main() { 
int a,b=78; 
if((a<5&&j<9) { 
a=a+h; g=6+7; 
a=a+b; printf("\n 
");
} if(a<n) 
{ h=j+k; 
} if(a<n)) 
{ g=h+k; 
}
}
stdout
Standard output is empty
stderr
ERROR: /home/JsohOq/prog:29:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? ERROR: Unknown option (h for help)
   Exception: (3) program ? ERROR: Can't ignore goal at this port
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? ERROR: Can't ignore goal at this port
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? % Execution Aborted
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit