This is a compiler for a programming language The Golden (official interpreter and documentation) made with LLVM.
tgc [options] <sources files...>
The compiler produces object file generated from code in source files.
In order to use the generated code, you'll need to have a C++ compiler installed in order to link the object file with libtgcore
(library which is part of the compiler and on which the generated code depends), libc
(C's standard library) and libm
(C's standard math library).
The usual compilation of single-file program then looks like this
# compile TG source
tgc [options] program.au -o program.o
# link the program
g++ -L/path/to/libtgcore program.o -ltgcore -o ./program
# run the program
./program
option | effect |
---|---|
--help |
show help |
--version |
show version |
-v [ --verbose ] |
show verbose output |
--ver version |
set TG version |
-o [ --output ] output_file |
set output file |
--input-file arg |
add input file |
--show-ir |
show LLVM IR of compiled modules |
--show-instrs |
show TG instructions (for debugging the compiler) |
--optimize |
run LLVM O2 optimization passes on the IR |
For now, the only supported TG version is 0.4.0E
(which is different from the official interpreter's 0.4.0
, but it's not far from it).
You'll need to have a C++ compiler, CMake, Boost (library) and LLVM (library) installed (findable by CMake's find_package
and with working llvm-config
). Then you can build the compiler from this directory:
cmake -S. -Bbuild --config Release
cmake --build build
The compiler and libtgcore will then be in ./out/
.