Red is a new programming language strongly inspired by REBOL, but with a broader field of usage thanks to its native-code compiler, from system programming to high-level scripting, while providing a modern support for concurrency and multi-core CPU.
The language is in its early bootstrap phase, once fully done, it will be self-hosted. The Red software stack contains also another language, Red/System, which is a low-level DSL. It is a limited C-level language with a REBOL look'n feel, required to build Red's runtime library and be the target language of Red's compiler. More information at red-lang.org.
The compiler and linker are currently written in REBOL and can produce Windows, Linux, Syllable, Android and Mac OS X executables. So, for now, a REBOL/Core binary is required to compile Red and Red/System programs. Please follow the instructions for installing the compiler tool-chain:
-
Clone this git repository or download an archive (
ZIP
button above or from tagged packages). -
Download a REBOL interpreter suitable for your OS: Windows, Linux, Mac OS X, FreeBSD, OpenBSD, Solaris
-
Extract the
rebol
binary, put it in root folder, that's all! -
Let's test it: run
./rebol
, you'll see a>>
prompt appear. Windows users need to click on therebol.exe
file to run it. -
From the REBOL console type:
do/args %red.r "%red/tests/hello.red"
The compilation process should finish with a ...output file size
message. The resulting binary is in the working folder. Windows users need to open a DOS console and run hello.exe
from there.
-
To see the intermediary Red/System code generated by the compiler, use:
do/args %red.r "-v 1 %red/tests/hello.red"
Command-line options:
-d : switches into debug mode.
-o <file> : outputs executable to given path and/or filename.
-t <target> : cross-compiles to another target (see table below).
-v <level> : sets verbose mode. 1-3 are for Red only, above for Red/System.
Important: Red will be distributed as a binary to end users and the effect of:
red script.red
will be to compile and run it from memory directly. So the -o option will become mandatory in the future for generating an executable without running it. During the bootstrap stage, it is complex to support that feature, but anyway, we will implement it as soon as possible.
-
From the REBOL console type:
change-dir %red-system/
-
Type:
do/args %rsc.r "%tests/hello.reds"
, the compilation process should finish with a...output file size
message. -
The resulting binary is in
red-system/builds/
, go try it! Windows users need to open a DOS console and runhello.exe
from there.
The %rsc.r
script is only a wrapper script around the compiler, for testing purpose. It accepts a -v <integer!>
option for verbose logs. Try it with:
>> do/args %rsc.r "-v 5 %tests/hello.reds"
Cross-compilation is easily achieved by using a -t
command line option followed by a target ID. This command-line option works for both Red and Red/System compilers.
Currently supported targets are:
Target ID | Description |
---|---|
MSDOS | Windows, x86, console-only applications |
Windows | Windows, x86, native applications |
Linux | GNU/Linux, x86 |
Linux-ARM | GNU/Linux, ARMv5 |
Darwin | Mac OS X Intel, console-only applications |
Syllable | Syllable OS, x86 |
Android | Android, ARMv5 |
For example, from Windows, to emit Linux executables:
>> do/args %rsc.r "-t Linux %tests/hello.reds"
From Linux, to emit Windows console executables:
>> do/args %rsc.r "-t MSDOS %tests/hello.reds"
Some anti-virus programs are a bit too sensitive and can wrongly report an alert on some binaries generated by Red, just ignore those alerts and if possible, remove the Red folder path from the anti-virus scanner. We will try to workaround that in future releases. The badly reacting anti-virus apps are: Avira, AntiVir, BitDefender, F-Secure, F-Prot, DrWeb, Commtouch, Panda.
Both Red and Red/System are published under BSD license, runtime is under BSL license. BSL is a bit more permissive license than BSD, more suitable for the runtime parts.