-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathrun.sh
executable file
·53 lines (51 loc) · 1.37 KB
/
run.sh
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
#!/bin/bash
NONE='\033[00m'
BLACK='\033[01;30m'
RED='\033[01;31m'
GREEN='\033[01;32m'
YELLOW='\033[01;33m'
BLUE='\033[01;34m'
PURPLE='\033[01;95m'
CYAN='\033[01;36m'
WHITE='\033[01;37m'
DGRAY='\033[01;90m'
BOLD='\033[1m'
UNDERLINE='\033[4m'
echo -e "\e[4m"
echo -e "${PURPLE} Compiling grammar....${PURPLE}"
tput sgr0
echo -e "${DGRAY}"
yacc -d grammar.y
tput sgr0
echo -e "\e[4m"
echo -e "${YELLOW} Compiling lexer....${YELLOW}"
tput sgr0
lex scanner.l
echo -e "\e[4m"
echo -e "${WHITE} Compiling all files....${WHITE}"
tput sgr0
g++ -std=c++14 -Wall lex.yy.c y.tab.c -ll -ly
echo -e "${CYAN} Now run ./a.out with your input file as an argument${CYAN}"
tput sgr0
./a.out test/input9.cpp > output/ast_output.txt
echo -e "Abstract Syntax Tree generated"
echo -e "\e[4m"
echo -e "${PURPLE} Compiling grammar....${PURPLE}"
tput sgr0
echo -e "${DGRAY}"
yacc -d icg_grammar.y
tput sgr0
echo -e "\e[4m"
echo -e "${YELLOW} Compiling lexer....${YELLOW}"
tput sgr0
lex icg_scanner.l
echo -e "\e[4m"
echo -e "${WHITE} Compiling all files....${WHITE}"
tput sgr0
g++ -std=c++14 -Wall lex.yy.c y.tab.c -ll -ly
echo -e "${CYAN} Now run ./a.out with your input file as an argument${CYAN}"
tput sgr0
./a.out test/input9.cpp > output/junk.txt
echo -e "Intermediate Three-Address Code generated"
python3 dead_code_elimination.py > output/junk.txt
echo -e "Code Optimization done. Dead Code Elimination"