%{
#include <stdio.h>
%}

%%

// Match integers
[0-9]+   { printf("%s\n", yytext); }

// Ignore everything else
.        ;

%%

// Main function
int main(int argc, char **argv) {
    if (argc > 1) {
        FILE *file = fopen(argv[1], "r");
        if (file) {
            yyin = file;
            yylex();
            fclose(file);
        } else {
            perror("Error opening file");
            return 1;
        }
    } else {
        fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
        return 1;
    }
    return 0;
}
