aboutsummaryrefslogtreecommitdiff
path: root/run.sh2
diff options
context:
space:
mode:
authorMustafa Quraish <[email protected]>2022-02-05 08:23:14 -0500
committerMustafa Quraish <[email protected]>2022-02-05 08:56:15 -0500
commitaeaf92127d1c090f9281616e49ad10dda414bd45 (patch)
treef85127c08b0caa13b95b3fb80e2996d3b5186434 /run.sh2
parentRemove old test which disallowed initializing globals (diff)
downloadcup-aeaf92127d1c090f9281616e49ad10dda414bd45.tar.xz
cup-aeaf92127d1c090f9281616e49ad10dda414bd45.zip
Add implementation of self-hosted compiler so far
There's also a `run.sh2` script which does the following: - Compiles the C compiler `build/cupcc` - Compiles the self-hosted compiler `build/cup.out` (with `cupcc`) - Compiles the specified file on CLI with `build/cup.out` - Runs this exectuable and shows the output
Diffstat (limited to 'run.sh2')
-rwxr-xr-xrun.sh228
1 files changed, 28 insertions, 0 deletions
diff --git a/run.sh2 b/run.sh2
new file mode 100755
index 0000000..0e6ee64
--- /dev/null
+++ b/run.sh2
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+# This script does the following:
+# 1. Builds the project
+# 2. Compiles selected file
+# 3. Assembles executable from compiled asm
+# 4. Runs the executable
+# 5. Echoes the output of the executable
+
+if [ -z "$1" ]
+then
+ echo "Usage: $0 <arguments to cupcc>"
+ exit 1
+fi
+
+set -xe
+
+make
+build/cupcc compiler/main.cup -o build/cup.nasm
+make build/cup.out
+build/cup.out "$@"
+make build/host.out
+
+set +e
+
+build/host.out
+
+echo "Exit status: $?" \ No newline at end of file