fork download
  1. /* symexpr.l */
  2. %{
  3. #include<string.h>
  4. extern char* temp;
  5. extern int lexerror;
  6. int yyerror(char* errmsg);
  7. extern char* errmsg;
  8. %}
  9. %%
  10. [xyz,()] { strcat(temp,yytext); return *yytext; }
  11. \n { return *yytext; }
  12. [ \t] { strcat(temp,yytext); } /* ignore whitespace */
  13. . { strcat(temp,yytext);
  14. sprintf(errmsg, "Invalid lexeme: '%c'.", *yytext);
  15. yyerror(errmsg);
  16. lexerror = 1; return *yytext; }
  17. %%
  18. int yywrap (void) {
  19. return 1;
  20. }
  21.  
Success #stdin #stdout #stderr 0.03s 6848KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/pcoqRP/prog:3:1: Syntax error: Operator expected
ERROR: /home/pcoqRP/prog:20:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit