Untitled
Anonymous
plain_text
03/09/2023 3:35 PM
332 B
25
Indexable
%{
#include <stdio.h>
int total = 0;
%}
%%
[0-9]+ { total += atoi(yytext); }
[-+*/\n] { /* Do nothing */ }
. { printf("Invalid input\n"); }
%%
int main()
{
yylex();
printf("Result: %d\n", total);
return 0;
}
Editor is loading...