Untitled
unknown
plain_text
3 years ago
249 B
7
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...