-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathiloc.sh
More file actions
executable file
·53 lines (42 loc) · 989 Bytes
/
iloc.sh
File metadata and controls
executable file
·53 lines (42 loc) · 989 Bytes
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
#!/bin/bash
#!/bin/bash
# arguments:
# 1: filename
run_on_file() {
# check if there's an input file
# get filename without extension
filename=$1
basename=$(basename $filename)
# check if there's an input file
# get filename without extension
input=$1
input="${input%.*}.in"
output="./output/${basename%.*}.ra.il"
# compile
time ./antlr/driver $1 > $output
# test
if test -f $input ; then
java -jar iloc.jar -s $filename < $input > original.txt
else
java -jar iloc.jar -s $filename > original.txt
fi
if test -f $input ; then
java -jar iloc.jar -s $output < $input > optimized.txt
else
java -jar iloc.jar -s $output > optimized.txt
fi
if diff original.txt optimized.txt ; then
echo "(No difference)"
fi
}
mkdir -p output
# do it on everything
for s in input/*.skip ; do
echo skipping $s...
done
for f in input/*.il ; do
echo
echo running on $f
run_on_file $f
done
echo "output files placed in output directory."