fork download
  1. %{
  2. /* Lex program to validate a binary message format */
  3. %}
  4. %%
  5. 1\.*101\n { puts("String follows the pattern."); }
  6.  
  7. [Ee][Xx][Ii][Tt]\n { return 0; }
  8.  
  9. .+\n { puts("String does not follow the pattern."); }
  10. %%
  11. inline int yywrap() { return 1; }
  12.  
  13. int main() {
  14. puts("Enter strings to be checked in each line. Enter EOF or 'exit' to exit.");
  15. yylex();
  16. }
  17.  
Success #stdin #stdout #stderr 0.03s 6880KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/BDoWH7/prog:16:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit