-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsloc.sh
executable file
·76 lines (61 loc) · 2.65 KB
/
sloc.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
73
74
75
#!/usr/bin/env bash
set -e
# Change to theories directory
cd "$(dirname "$(realpath "$0")")/../theories"
# Accumulate overall totals
total_spec=0
total_proof=0
# Array to hold formatted table rows.
declare -a rows
count_slocs() {
desc="$1"
shift
last_line=$(coqwc "$@" | tail -n1)
# Get the last line from coqwc output with the totals for the given files.
spec=$(echo "$last_line" | awk '{print $1}')
proof=$(echo "$last_line" | awk '{print $2}')
specproof=$((spec + proof))
# Update the global totals
total_spec=$((total_spec + spec))
total_proof=$((total_proof + proof))
# Format the table row with the data
rows+=("$(printf " & %-25s & %-13s & %-12s \\\\\\ %% %s" "$desc" "$spec" "$proof" "$specproof")")
}
################################################################################
# Generic
################################################################################
count_slocs "Base logic" BaseLogic.v Worlds.v
count_slocs "Infrastructure" Environment.v Instantiation.v Prelude.v Substitution.v Sub/Parallel.v Sub/Prefix.v
count_slocs "Unification" Sub/Triangular.v Unification.v
count_slocs "Monad interface" Monad/Interface.v
count_slocs "Logical relation" Related/Monad/Free.v Related/Monad/Interface.v
count_slocs "Free monad" Monad/Free.v
count_slocs "Monad interface (HOAS)" Shallow/Monad/Interface.v
count_slocs "Open modality" Open.v
count_slocs "Free monad (HOAS)" Shallow/Monad/Free.v
count_slocs "Prenex monad" Monad/Prenex.v
count_slocs "Solved monad" Monad/Solved.v
count_slocs "Prenex conversion" PrenexConversion.v
# Now print the generic table
echo "\\textbf{I} & \\textbf{Generic} & \\textbf{$total_spec} & \\textbf{$total_proof} \\\\[0.3em]"
printf "%s\n" "${rows[@]}"
################################################################################
# Specific
################################################################################
# Reset the variables
total_spec=0
total_proof=0
rows=()
count_slocs "Generators (HOAS)" Shallow/Gen/Bidirectional.v Shallow/Gen/Check.v Shallow/Gen/Synthesise.v
count_slocs "Generator (bidir)" Gen/Bidirectional.v
count_slocs "Relatedness" Related/Gen/Bidirectional.v Related/Gen/Check.v Related/Gen/Synthesise.v
count_slocs "Generator (check)" Gen/Check.v
count_slocs "Infrastructure" InstantiationStlc*.v SubstitutionStlc*.v
count_slocs "Generator (synth)" Gen/Synthesise.v
count_slocs "Composition" Composition.v
count_slocs "Specification" Spec.v
count_slocs "Unification" UnificationStlc*.v
count_slocs "Extraction" Extraction.v
# Now print the specific table
echo "\\textbf{II} & \\textbf{Specific} & \\textbf{$total_spec} & \\textbf{$total_proof} \\\\[0.3em]"
printf "%s\n" "${rows[@]}"