diff options
| -rw-r--r-- | .gitignore | 3 | ||||
| -rw-r--r-- | README.md | 22 | ||||
| -rwxr-xr-x | build.sh | 5 | ||||
| -rwxr-xr-x | run.sh | 2 | ||||
| -rwxr-xr-x | stick.sh | 4 | ||||
| -rw-r--r-- | tnslc.tnsl | 5 |
6 files changed, 33 insertions, 8 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8b6c59f --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*.o +build/ + @@ -2,14 +2,26 @@ The reference compiler for the TNSL programming language. The compiler is written in TNSL. +## Requirements: +- `nasm` - netwide assembler + - To bootstrap we build an initial `tnslc` from the `stuck` directory + - `tnslc` currently outputs nasm compatible x64 asm +- `gcc` - c compiler (any will do, just change in build.sh) + - we use this to link with libc at the moment until the compiler is in a more complete state + ## Usage: -Place the [bootstrap compiler](https://git.cshift.net/CircleShift/ctc) `ctc` in this folder and execute `build.sh tnslc` -The compiler outputs x86 NASM compatible assembly. +Bootstrap using the `setup.sh` script, this builds an initial tnslc from the asm in `stuck` + +Build using the provided `build.sh` script, it takes the file you want to build as an argument +- For example: `build.sh tnslc` will build the file named `tnslc.tnsl` and place artifacts in the `build` directory + +Run the compiler (once you build it) using the `run.sh` script (works the same way as build.sh) or just copy the +binary and use it as you please. Run outputs into `build/NEXT` by default -Examples: -- `./ctc dummy.tnsl dummy.asm` - Run the bootstrap compiler on the dummy file, output to dummy.asm -- `./build.sh tnslc` - Build the compiler +To update the "stuck" version of the compiler we are using for bootstrap, run `stick.sh` after building the +compiler with `build.sh`. This will copy the tnslc asm from the `build` diretory into the `stuck` directory +and re-build the bootstrap compiler from it. ## License @@ -1,6 +1,6 @@ #!/bin/bash -BUILD_DIR=./out +BUILD_DIR=./build ARTIFACT_DIR=$BUILD_DIR/artifacts mkdir -p $BUILD_DIR @@ -8,7 +8,8 @@ mkdir -p $ARTIFACT_DIR filename=$1 filename="${filename%.*}" -./ctc $filename.tnsl $ARTIFACT_DIR/$filename.asm +./stuck/tnslc $filename.tnsl +mv out.asm $ARTIFACT_DIR/$filename.asm if [ $? -ne 0 ]; then exit $? @@ -1,6 +1,6 @@ #!/bin/bash -BUILD_DIR=./out/NEXT +BUILD_DIR=./build/NEXT ARTIFACT_DIR=$BUILD_DIR/artifacts mkdir -p $BUILD_DIR @@ -1,3 +1,7 @@ +rm stuck/* +cp build/artifacts/tnslc.asm stuck/tnslc.asm +nasm -f elf64 -g -o stuck/tnslc.o stuck/tnslc.asm +gcc -g -o stuck/tnslc stuck/tnslc.o @@ -0,0 +1,5 @@ + +/; main [int] + return 1 +;/ + |