-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
58 lines (48 loc) · 1023 Bytes
/
main.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/* IFJ Projekt
* Implementantion of compiler for IFJ18
*
* TEAM:
* Simon Kobyda
* Michal Zelenak
* Juraj Samuel Salon
* Denis Filo
*
* FILE: main.c
* FILE AUTHOR: Simon Kobyda (xkobyd00)
*/
/***SYSTEM FILES***/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
/***LOCAL FILES***/
#include "parser.h"
#include "parser-semantic.h"
#include "scanner.h"
#include "generator.h"
int retval = 0;
void PrintError(int val, unsigned int line, const char *format, ...) {
if (!format)
return;
if (!retval)
retval = val;
va_list args;
va_start(args, format);
if (line) {
fprintf(stderr, "ERROR: Line %u:", line);
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
} else {
fprintf(stderr, "ERROR");
vfprintf(stderr, format, args);
fprintf(stderr, "\n");
}
va_end(args);
}
int main() {
/* Pokes generator */
Generator();
if (!Parser())
return 99;
else
return retval;
}