-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·32 lines (25 loc) · 887 Bytes
/
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
#!/bin/bash
# Usage: ./run.sh <mode> <file>
# mode: scan|tokens|parse|pretty|symbol|typecheck|codegen
# Check the command-line arguments are valid
if [ $# -lt 2 ]
then
echo "Missing arguments"
echo "Usage: $0 <mode> <file>"
echo " + mode: scan|tokens|parse|pretty|symbol|typecheck|codegen"
echo " + file: path to file (absolute or relative)"
exit 1
fi
if [[ "|scan|tokens|parse|pretty|symbol|typecheck|codegen|" != *"|$1|"* ]]
then
echo "Unknown mode \"$1\""
echo "Usage: $0 <mode> <file>"
echo " + mode: scan|tokens|parse|pretty|symbol|typecheck|codegen"
echo " + file: path to file (absolute or relative)"
exit 1
fi
# Invoke the compiler with the provided arguments: mode ($1) and file ($2)
#
# You MUST replace the following command with the command for invoking your compiler
filename="${2%.*}"
./src/golitec "$1" "$filename" < "$2"