Red Programming Language
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.
Running the Red hello script
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 (
ZIPbutton above or from tagged packages).
rebolbinary, 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 the
rebol.exefile 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"
-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:
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.
Running the Red/System hello script
From the REBOL console type:
do/args %rsc.r "%tests/hello.reds", the compilation process should finish with a
...output file sizemessage.
The resulting binary is in
red-system/builds/, go try it! Windows users need to open a DOS console and run
%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:
|MSDOS||Windows, x86, console-only applications|
|Windows||Windows, x86, native applications|
|Darwin||Mac OS X Intel, console-only applications|
|Syllable||Syllable OS, x86|
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"
Anti-virus false positive
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.