Untitled
unknown
plain_text
2 years ago
249 B
1
Indexable
Never
%{ #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; }