-
Notifications
You must be signed in to change notification settings - Fork 0
/
Compilers.c
80 lines (71 loc) · 1.9 KB
/
Compilers.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
************************************************************
* COMPILERS COURSE - Algonquin College
* Code version: Winter, 2022
* Author: Sohrab Najafzadeh
* Professors: Paulo Sousa / George Kriger / Abdullah Kadri
************************************************************
*/
/*
************************************************************
* File name: compilers.c
* Compiler: MS Visual Studio 2022
* Author: Paulo Sousa
* Course: CST 8152 – Compilers, Lab Section: [011, 012, 013, 014]
* Assignment: A12, A22, A32.
* Date: May 01 2021
* Professor: Paulo Sousa
* Purpose: This file is the main program of Compilers Project
* Function list: main().
************************************************************
*/
#include <stdio.h>
#include <stdlib.h>
#ifndef COMPILERS_H_
#include "Compilers.h"
#endif
/*
***********************************************************
* Function name: main
* Purpose: Main function
* Author: Paulo Sousa
* History/Versions: Ver 1.0
* Called functions: mainBuffer(), mainScanner(), mainParser()
* Parameters: Command line arguments - argc, argv
* Return value: Status
* Algorithm: -
*************************************************************
*/
oslo_int main(int argc, char** argv) {
oslo_int i;
if (DEBUG) {
for (i = 0; i < argc; ++i)
printf("argv[%d] = %s\n", i, argv[i]);
}
if (argc < 2) {
printf("%s%s%c%s%c%s%c%s", argv[0], ": OPTIONS [",
PGM_BUFFER, "] - Buffer, [",
PGM_SCANNER, "] - Scanner, [",
PGM_PARSER, "] - Parser\n");
return EXIT_FAILURE;
}
oslo_char option = argv[1][0];
switch (option) {
case PGM_BUFFER:
//mainBuffer(argc, argv);
break;
case PGM_SCANNER:
//mainScanner(argc, argv);
break;
case PGM_PARSER:
mainParser(argc, argv);
break;
default:
printf("%s%s%c%s%c%s%c%s", argv[0], ": OPTIONS [",
PGM_BUFFER, "] - Buffer, [",
PGM_SCANNER, "] - Scanner, [",
PGM_PARSER, "] - Parser\n");
break;
}
return EXIT_SUCCESS;
}