-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathepsilon.c
39 lines (30 loc) · 815 Bytes
/
epsilon.c
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
31
32
33
34
35
36
37
38
39
#include "interpreter/interpret.h"
#include "parser.h"
#include "lexer/lexer.h"
#include "core/ds/dict.h"
#include "core/ds/list.h"
#include "core/errors.h"
#include "core/memory.h"
#include <stdio.h>
#include <sys/time.h>
int main(int argc, char *argv[]) {
if (argc < 2) {
EpsErr_Fatal("no input file provided");
}
#ifdef EPS_DBG
struct timeval t1, t2;
double elapsedTime;
gettimeofday(&t1, NULL);
#endif
Eps_Input *input = Eps_ReadFile(argv[1]);
EpsList *toks = Eps_Lex(input);
EpsList *stmts = Eps_Parse(toks);
Eps_Interpret(stmts);
#ifdef EPS_DBG
gettimeofday(&t2, NULL);
elapsedTime = (t2.tv_sec - t1.tv_sec) * 1000.0;
elapsedTime += (t2.tv_usec - t1.tv_usec) / 1000.0;
printf("Finished in: %f ms.\n", elapsedTime);
#endif
return 0;
}