-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsyn-run
executable file
·51 lines (47 loc) · 1.07 KB
/
syn-run
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
#!/bin/bash
BASE_PATH=$(dirname $(realpath $0))
VM="$BASE_PATH/synvm/vm.js"
DEBUG=""
COMPILE_ONLY=""
TRACE=""
while getopts ":otdcCjh" opt; do
case ${opt} in
o )
COMPILE_ONLY="true"
;;
d )
DEBUG="-d"
;;
c )
VM="$BASE_PATH/c/bin/synvmc"
;;
C )
VM="dotnet $BASE_PATH/cs/synsharp/bin/Debug/netcoreapp2.0/synsharp.dll"
;;
j )
VM="$BASE_PATH/synvm/vm.js"
;;
t )
TRACE="-t"
;;
h )
echo "Usage: syn-run [-d] [-t] [-c] [-C] [-j] <program_name(.bc)>"
echo "-o: only compile, do not run"
echo "-t: enable vm tracing"
echo "-d: enable debugging (Currently only works with the js vm)"
echo "-c: use c vm"
echo "-C: use csharp vm"
echo "-j: use javascript vm (default)"
exit 0
;;
esac
done
shift $((OPTIND -1))
NAME=${1%.*}
dotnet run --no-build --project $BASE_PATH/cs/syncomp/Syncomp.Cli $NAME.bc &&
$BASE_PATH/synasm/asm.js $NAME.asm || exit 1
if [ -z $COMPILE_ONLY ]
then
$VM $DEBUG $TRACE -b $NAME.bin
fi
exit $?