From aeaf92127d1c090f9281616e49ad10dda414bd45 Mon Sep 17 00:00:00 2001 From: Mustafa Quraish Date: Sat, 5 Feb 2022 08:23:14 -0500 Subject: 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 --- run.sh2 | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 run.sh2 (limited to 'run.sh2') 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 " + 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 -- cgit v1.2.3