Repository navigation
Expand file tree
/
Copy pathCompilers.c
More file actions
121 lines (109 loc) · 3.32 KB
/
Copy pathCompilers.c
File metadata and controls
121 lines (109 loc) · 3.32 KB
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
************************************************************
* COMPILERS COURSE - Algonquin College
* Code version: Winter, 2023
* Author: TO_DO
* Professors: Paulo Sousa
************************************************************
*/
/*
************************************************************
* File name: compilers.c
* Compiler: MS Visual Studio 2022
* Course: CST 8152 – Compilers, Lab Section: [011, 012, 013]
* Assignment: A12, A22, A32.
* Date: Jan 01 2023
* 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
/*
* ............................................................................
* ADVICE 1:
* Please check the "TODO" labels to develop your activity.
*
* ADVICE 2: This file must be updated according to each assignment
* (see the progression: reader > scanner > parser).
* ............................................................................
*/
/*
***********************************************************
* Function name: main
* Purpose: Main function
* Author: Paulo Sousa
* History/Versions: Ver F22
* Called functions: mainReader(), mainScanner(), mainParser()
* Parameters: Command line arguments - argc, argv
* Return value: Status
* Algorithm: -
*************************************************************
*/
zeus_intg main(int argc, char** argv) {
zeus_intg i;
zeus_char option;
printLogo();
if (DEBUG) {
for (i = 0; i < argc; ++i)
printf("argv[%d] = %s\n", i, argv[i]);
}
if (argc < 2) {
printf("%s%c%s%c%s%c%s", "OPTIONS:\n* [",
PGM_READER, "] - Reader\n* [",
PGM_SCANNER, "] - Scanner\n* [",
PGM_PARSER, "] - Parser\n");
return EXIT_FAILURE;
}
option = argv[1][0];
switch (option) {
case PGM_READER:
printf("%s%c%s", "\n[Option '", PGM_READER, "': Starting READER .....]\n\n");
mainReader(argc, argv);
break;
case PGM_SCANNER:
printf("%s%c%s", "\n[Option '", PGM_SCANNER, "': Starting SCANNER ....]\n\n");
mainScanner(argc, argv);
break;
case PGM_PARSER:
printf("%s%c%s", "\n[Option '", PGM_PARSER, "': Starting PARSER .....]\n\n");
mainParser(argc, argv);
break;
default:
printf("%s%c%s%c%s%c%s", "* OPTIONS:\n- [",
PGM_READER, "] - Reader\n- [",
PGM_SCANNER, "] - Scanner\n- [",
PGM_PARSER, "] - Parser\n");
break;
}
return EXIT_SUCCESS;
}
/*
***********************************************************
* Function name: printLogo
* Purpose: pRINT lOGO
* Author: Paulo Sousa
* History/Versions: Ver F22
* Called functions: -
* Parameters: -
* Return value: (Null)
* Algorithm: -
*************************************************************
*/
zeus_void printLogo() {
printf("%s%s%s%s%s%s%s%s%s",
" oooooooooooo oooooooooooo ooooo ooo .oooooo..o \n",
" d d888' `888' `8 `888' `8' d8P' `Y8 \n",
" .888P 888 888 8 Y88bo. \n",
" d888 888oooo8 888 8 `Y8888o. \n",
" .888P 888 888 8 ` Y88b \n",
" d888' .P 888 o `88. .8' oo .d8P \n",
".8888888888P o888ooooood8 `YbodP' 80088888P' \n",
" \n",
" By: Ahnaf Kamal and Skylar Phanenhour \n"
);
}