summaryrefslogtreecommitdiffstats
path: root/src/main.c
blob: 4b46032a92b23f95e4d71beace26cf2047d7df2e (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
#include <stdio.h>
#include <stdlib.h>
#include "ast.h"
#include "src/libparser_a-parser.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: