summaryrefslogtreecommitdiffstats
path: root/test cases/frameworks/8 flex/prog.c
blob: ae481d0983276d7fe1e9441f4a80461200d923d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include"parser.tab.h"
#include<unistd.h>
#include<sys/types.h>
#include<sys/stat.h>
#include<fcntl.h>
#include<stdio.h>
#include<stdlib.h>

extern int yyparse();

int main(int argc, char **argv) {
    int input;
    if(argc != 2) {
        printf("%s <input file>\n", argv[0]);
        return 1;
    }
    input = open(argv[1], O_RDONLY);
    dup2(input, STDIN_FILENO);
    close(input);
    return yyparse();
}

int yywrap(void) {
     return 0;
}

int yyerror(void) {
     printf("Parse error\n");
     exit(1);
}