-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.c
30 lines (28 loc) · 1.53 KB
/
error.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
///////////////////////////////////////////////////////////////////////////////////
// School: Brno University of Technology, Faculty of Information Technology //
// Course: Formal Languages and Compilers //
// Project: IFJ17 //
// Module: Error states //
// Authors: Kristián Liščinský (xlisci01) //
// Matúš Liščinský (xlisci02) //
// Šimon Stupinský (xstupi00) //
// Vladimír Marcin (xmarci10) //
///////////////////////////////////////////////////////////////////////////////////
#include <stdio.h>
#include <stdlib.h>
#include "error.h"
#include "clear.h"
void print_err(int id)
{
switch(id){
case 1: fprintf(stderr,"Error in the program associated with lexical analysis\n"); break;
case 2: fprintf(stderr,"Error in the program associated with syntax analysis\n"); break;
case 3: fprintf(stderr,"Semantic error in the program\n"); break;
case 4: fprintf(stderr,"Semantic type compatibility error\n"); break;
case 6: fprintf(stderr,"Others semantic error\n"); break;
case 99: fprintf(stderr,"Internal error of compiler\n"); break;
}
clear_all(); /// clear all allocated memory
free(ptr_stack); /// clear memory for pointer stack
exit(id); /// exit program with equivalent id
}