aboutsummaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rwxr-xr-xmeta/bootstrap.sh25
-rwxr-xr-xmeta/create_bootstrap.sh21
-rwxr-xr-xmeta/run.sh6
3 files changed, 52 insertions, 0 deletions
diff --git a/meta/bootstrap.sh b/meta/bootstrap.sh
new file mode 100755
index 0000000..bc8b437
--- /dev/null
+++ b/meta/bootstrap.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+# Bootstrap the initial compiler, and verify that it works.
+
+set -e
+
+case "$(uname -s)" in
+ Darwin)
+ cp bootstrap/macos.nasm bootstrap/cup.nasm
+ ;;
+ Linux)
+ cp bootstrap/linux.nasm bootstrap/cup.nasm
+ ;;
+esac
+
+echo "[+] Compiling the bootstrap compiler..."
+make bootstrap/cup.out
+mkdir -p build
+
+echo "[+] Creating build/cup.out with bootstrap compiler..."
+./bootstrap/cup.out compiler/main.cup -o build/cup.nasm
+make build/cup.out
+rm -f bootstrap/cup.nasm
+
+echo "[+] Bootstrap complete!" \ No newline at end of file
diff --git a/meta/create_bootstrap.sh b/meta/create_bootstrap.sh
new file mode 100755
index 0000000..312b395
--- /dev/null
+++ b/meta/create_bootstrap.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# Checkpoint the current state of the system by creating a new bootstrap
+# NASM file for MacOS and Linux to ./bootstrap/
+
+# TODO
+set -xe
+
+build/cup.out compiler/main.cup -o bootstrap/cup.nasm
+make bootstrap/cup.out
+
+case "$(uname -s)" in
+ Darwin)
+ cp bootstrap/cup.nasm bootstrap/macos.nasm
+ ;;
+ Linux)
+ cp bootstrap/cup.nasm bootstrap/linux.nasm
+ ;;
+esac
+
+rm -f bootstrap/cup.nasm
diff --git a/meta/run.sh b/meta/run.sh
new file mode 100755
index 0000000..020e0cd
--- /dev/null
+++ b/meta/run.sh
@@ -0,0 +1,6 @@
+#!/bin/bash
+
+build/cup.out "$1" -o build/output.nasm
+shift
+make build/output.out
+build/output.out "$@" \ No newline at end of file