-
Notifications
You must be signed in to change notification settings - Fork 2
/
compile.sh
executable file
·72 lines (62 loc) · 1.42 KB
/
compile.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#!/bin/bash
usage()
{
cat << EOF
usage: $0 inputfile.cll {options}
This script will compile CLL into EVM3-ASM code for Ethereum
OPTIONS:
-h
Show this message
-i
Enable inspection (shows assembled output, line-by-line)
-t "regex"
Used with -i. Trace lines in the assembled piece using "regex".
-s
Skips "====" style lines, and compiles each
block between "====" as independant programs.
EOF
}
DO_INSPECT=0
DO_TRACE=0
TRACE_REGEX=
SKIP_MULTIEQUAL=
# This skips the first argument, so we can use it as the input file name (always required)
while getopts “hit:s” OPTION ${@:2};
do
case $OPTION in
h)
usage
exit 1
;;
i)
DO_INSPECT=1
;;
t)
DO_TRACE=1
TRACE_REGEX=$OPTARG
;;
s)
SKIP_MULTIEQUAL=skipmultiequal
;;
?)
usage
exit
;;
esac
done
TEMP_FILE=/tmp/inspect.asm
echo $1
if [[ -e $1 ]]; then
php -q cllPreProcessor.php $1 $SKIP_MULTIEQUAL
eval "python docompile.py | tee $TEMP_FILE"
if [ $DO_INSPECT == 1 ]; then
if [ $DO_TRACE == 1 ]; then
php -q postInspection.php $TEMP_FILE "$TRACE_REGEX"
else
php -q postInspection.php $TEMP_FILE
fi
fi
else
echo "The file $1 doesn't exist. Pass in your file.cll as the first argument."
fi
printf "\n\n\n"