blob: 7e6811d5047640a5eb0aafc6148594aacea10dfb (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# Paradox: A self-hosted FALSE compiler for Linux x86-64
Paradox is a FALSE compiler emitting 64-bit NASM, written in FALSE itself, targeting the Linux syscall ABI.
Made for [code guessing, round #41](https://cg.esolangs.gay/41/).
Prerequisites: You need NASM and an ELF64 linker in addition to paradox to compile programs.
You can use an existing FALSE implementation or the included bootstram.asm to bootstrap paradox.
## Bootstrapping using bootstrap.asm
```sh
# compile bootstrap
nasm -f elf64 bootstrap.asm && ld bootstrap.o -o bootstrap
# use bootstrap to compile paradox
./bootstrap < paradox.false > paradox.asm && nasm -f elf64 paradox.asm && ld paradox.o -o paradox
# verify the resulting binaries are equal
diff bootstrap paradox
```
## Bootstrapping using an existing FALSE implementation
Note: paradox uses ø and ß rather than O and B in its own source code. It still supports O and B; to bootstrap paradox with a FALSE implementation that does not support these symbols, use `sed -i 's/ø/O/g;s/ß/B/g' paradox.false` to substitute them.
```sh
# build stage2 using an existing false implementation to run paradox ("stage 1")
existing_run_false paradox.false < paradox.false > stage2.asm && nasm -f elf64 stage2.asm && ld stage2.o -o stage2
# rebuild paradox with itself (stage 3)
./stage2 < paradox.false > stage3.asm && nasm -f elf64 stage3.asm && ld stage3.o -o paradox
# verify the resulting binaries are equal
diff stage2 paradox
```
## Additional notes
For convenience and to conform with the CG spec, paradox includes a `run.sh` script that will automatically compile and execute a file.
```sh
./run.sh my_file.false
```
|