fork download
  1. %{
  2. #include <stdio.h>
  3. %}
  4.  
  5. %%
  6. \+|\/|\* { printf("operateur\n"); } // Match '+', '/', or '*' and print "operateur"
  7. F+ { printf("Une suite de F\n"); } // Match one or more 'F' and print the message
  8. (ab){2,} { printf("Deux ab ou plus\n"); } // Match "ab" repeated two or more times
  9. [A-Za-z0-9]{3} { printf("Mot de longueur 3\n"); } // Match exactly 3 characters (letters or digits)
  10. . { /* Ignore other characters */ } // Ignore any other input
  11. %%
  12.  
  13. int main() {
  14. yylex(); // Start scanning input
  15. return 0;
  16. }
  17.  
Success #stdin #stdout #stderr 0.03s 6768KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/qlAR7L/prog:2:1: Syntax error: Operator expected
ERROR: /home/qlAR7L/prog:16:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit