fork download
  1. %{
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. %}
  5.  
  6. %%
  7. // --- Regular Expressions (token definitions) ---
  8. int [a-zA-Z_][a-zA-Z0-9_]*
  9. float [0-9]+\.[0-9]+
  10. digit [0-9]+
  11. keyword int|float|if|else|for|while|return
  12.  
  13. // ---
  14. [ERROR] AxiosError: {
  15. "error": {
  16. "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://p...content-available-to-author-only...i.com/account/api-keys.",
  17. "type": "invalid_request_error",
  18. "param": null,
  19. "code": null
  20. }
  21. }
  22. 401
  23. {
  24. "date": "Tue, 12 Aug 2025 06:24:16 GMT",
  25. "content-type": "application/json; charset=utf-8",
  26. "content-length": "496",
  27. "connection": "close",
  28. "vary": "Origin",
  29. "x-request-id": "req_7385805c256343c5992ae76fa073ca69",
  30. "x-envoy-upstream-service-time": "3",
  31. "cf-cache-status": "DYNAMIC",
  32. "set-cookie": [
  33. "__cf_bm=uymJ3HCgvMlhxdO1m_cjEsTSYfqygOKp6xQ4PnHoK8k-1754979856-1.0.1.1-jTgbLeDJ7FJPleUJgTkkDoVWfsh_sgUs.9W.Md68RBVFS8pN0KeTUCX3yJ13e2AcxSmZl6MtwHfZb2b6irY92bHdhvLV.rHAPInV966NihY; path=/; expires=Tue, 12-Aug-25 06:54:16 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None",
  34. "_cfuvid=VieeUa9Ar4WDnRjTUgxeIYGShYWAARMC.RWLlt48ZHA-1754979856286-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None"
  35. ],
  36. "strict-transport-security": "max-age=31536000; includeSubDomains; preload",
  37. "x-content-type-options": "nosniff",
  38. "server": "cloudflare",
  39. "cf-ray": "96dde37e78db9f41-HYD",
  40. "alt-svc": "h3=\":443\"; ma=86400"
  41. }
  42.  
  43. Request failed with status code 401Token Rules and Actions ---
  44. {keyword} { printf("Token: %s | Type: KEYWORD\n", yytext); }
  45. {float} { printf("Token: %s | Type: CONSTANT (FLOAT)\n", yytext); }
  46. {digit} { printf("Token: %s | Type: CONSTANT (INT)\n", yytext); }
  47. {int} { printf("Token: %s | Type: IDENTIFIER\n", yytext); }
  48. "+"|"-"|"*"|"/" { printf("Token: %s | Type: OPERATOR\n", yytext); }
  49. "(" | ")" | ";" | "," { printf("Token: %s | Type: PUNCTUATION\n", yytext); }
  50. [ \t\n\r]+ { /* Ignore whitespace */ }
  51. . { printf("Token: %s | Type: UNKNOWN\n", yytext); }
  52.  
  53. %%
  54.  
  55. // --- Main Function ---
  56. int main(int argc, char** argv) {
  57. yylex(); // Start lexical analysis
  58. return 0;
  59. }
Success #stdin #stdout #stderr 0.02s 6984KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/3GIjNY/prog:2:1: Syntax error: Operator expected
ERROR: /home/3GIjNY/prog:59:0: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit