There’s a new REBOL like programming language in town. It’s called Red, it’s BSD licensed and contrary to REBOL and Boron, Red is a compiled language. The Syllable project is proud to announce that Red programs now run on Syllable Desktop. Here is a screenshot from a demo program. Syllable is the third Red target platform, after Windows and Linux.
Red was introduced at the REBOL & Boron conference in the Netherlands in February by its creator Nenad Rakocevic from Paris, previously of Cheyenne fame. The project is less than half a year old and has been public for a mere three months, but the first phase of the language, the design and implementation of the Red/System dialect is already nearing completion. It will be presented at the Cht’i RUG 2011 in Lille, France. If you are in time for the conference, you can follow it live on Twitter.
Red’s name hints at its goal to offer a reduced REBOL dialect that is suitable for compilation, while still being as much like REBOL as possible. The new language is currently being bootstrapped in an ingenious way. The demo program is not written in Red yet, but in Red/System, yet another REBOL like dialect. Red/System is a low level language comparable to C, with similar capabilities. It will be used in the next phase to implement the higher level Red language.
Red was ported to Syllable in a collaboration with the REBOL community. Syllable Desktop has its own in-kernel ELF loader. Red has its own ELF executable format emitter. At first they didn’t match, because both try to be lean and don’t implement the full ELF specification. Syllable always generates its own program executables as Position Independent Code, as if they were shared libraries. As such, Syllable expects all binaries to have section headers. Red’s backend doesn’t support PIC yet and didn’t strictly need section headers. Andreas Bolka implemented them for Syllable and for the coming PIC implementation in Red. He also implemented proper address alignment, which Syllable requires more strictly than the GNU loader on Linux. Finally, the starting address of the generated binaries was moved to Syllable’s user address space, and an embedded kernel syscall was adapted.
Red/System already has several interesting properties. It is a complete compiler toolchain, including a native code generator and a static linker. It is tiny and does not need the huge GCC or even the GNU linker. The LLVM JIT compiler infrastructure was considered, but also deemed unsuitable due to its bloat. The compiler is currently written in REBOL 2, which means it must be run on one of the REBOL 2 platforms: Linux, FreeBSD, OpenBSD, Mac or Windows. However, Red/System can trivially be used as a cross-compiler, so Syllable programs can now be cross-developed from those platforms. Once the Red language is implemented, the compiler will be ported from REBOL to Red. It will then also run on Syllable itself, and it will be possible to use Syllable to cross-develop for other Red platforms. Eventually, a JIT compiler will be added, opening even more possibilities with dynamic compilation.