-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.sh
executable file
·95 lines (71 loc) · 1.33 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
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
#!/bin/bash
#
# Usage:
# ./run.sh <function name>
set -o nounset
set -o pipefail
set -o errexit
download() {
wget https://deno.land/x/install/install.sh
chmod +x install.sh
}
# Puts it in $HOME/.deno/
# I prefer ~/install, but OK
deno() {
~/.deno/bin/deno "$@"
}
hi() {
time deno run hi.ts
}
readonly YAKS_FILES='header.ts lex.ts parse.ts transform.ts check.ts eval.ts ops.ts yaks.ts'
fmt() {
deno fmt --single-quote $YAKS_FILES tests.ts
}
lint() {
local more=',no-unused-vars'
more=''
deno lint \
--rules-exclude="prefer-const,no-unreachable,no-fallthrough$more" \
$YAKS_FILES tests.ts
}
bundle() {
deno bundle yaks.ts web/yaks-bundle.js
}
check-run() {
local name=$1
time deno check $name.ts
echo --
time deno run $name.ts
}
# https://matklad.github.io/2023/08/17/typescript-is-surprisingly-ok-for-compilers.html
matklad-test() {
check-run matklad-test
}
bool-int-andy-test() {
check-run bool-int-andy-test
}
tests() {
deno test tests.ts "$@"
}
count() {
wc -l *.ts
echo
# The production code
wc -l $YAKS_FILES
echo
# 446 lines!
echo 'Lexing / Parsing / Errors'
wc -l lex.ts parse.ts transform.ts yaks.ts
echo
# 214 lines
echo 'Logic'
wc -l check.ts eval.ts ops.ts
echo
echo 'Bundle'
wc -l web/yaks-bundle.js
echo
echo 'Docs'
wc -l doc/*.md
echo
}
"$@"