summaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: fde8aefff1fa598581c6e806bb7356d86fdfcf9f (plain) (blame)
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
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

#include "ast.h"
#include "libparser_a-parser.h"

#include <stdio.h>
#include <stdlib.h>

extern FILE *yyin;
extern AST_NODE *prog;

int main (int argc, char **argv)
{
    if (argc != 2) {
        fputs("usage: parser [source file]\n", stderr);
        exit(1);
    }
    yyin = fopen(argv[1],"r");
    if (yyin == NULL) {
        fputs("Error opening source file.\n", stderr);
        exit(1);
    }
    yyparse();
    printGV(prog, NULL);
    return 0;
}

// vim: set sw=4 ts=4 sts=4 et: