Red | |
Paradigm: | Multi-paradigm |
Designer: | Nenad Rakočević[1] |
Developer: | Nenad Rakočević |
Latest Release Date: | February 19, 2024 |
License: | modified BSD and Boost |
Logo Alt: | Red Logo (stylized Tower of Hanoi) |
Year: | 2011 |
Latest Release Version: | 0.6.5[2] (Beta) |
Influenced By: | Rebol, Lisp, Scala, Lua |
Operating System: | Linux, Windows, OS X |
File Ext: | .red, .reds |
Red is a programming language designed to overcome the limitations of the programming language Rebol.[3] Red was introduced in 2011 by Nenad Rakočević, and is both an imperative and functional programming language. Its syntax and general usage overlaps that of the interpreted Rebol language.[4]
The implementation choices of Red intend to create a full stack programming language:[5] Red can be used for extremely high-level programming (DSLs and GUIs) as well as low-level programming (operating systems and device drivers). Key to the approach is that the language has two parts: Red/System and Red.[6]
Red seeks to remain independent of any other toolchain; it does its own code generation.[9] It is therefore possible to cross-compile[10] Red programs from any platform it supports to any other, via a command-line switch. Both Red and Red/System are distributed as open-source software under the modified BSD license. The runtime library is distributed under the more permissive Boost Software License.
As of version 0.6.4 Red includes a garbage collector "the Simple GC".[11]
Red was introduced in the Netherlands in February 2011 at the Rebol & Boron conference[12] by its author Nenad Rakočević. In September 2011, the Red programming language was presented to a larger audience during the Software Freedom Day 2011.[13] [14] Rakočević is a long-time Rebol developer known as the creator of the Cheyenne HTTP server.[15]
Red's syntax and semantics are very close to those of Rebol.[16] Like Rebol, it strongly supports metaprogramming and domain-specific languages (DSLs) and is therefore a highly efficient tool for dialecting (creating embedded DSLs). Red includes a dialect called Red/System, a C-level language which provides system programming facilities. Red is easy to integrate with other tools and languages as a DLL (libRed) and very lightweight (around 1 MB). It is also able to cross-compile to various platforms (see Cross Compilation section below) and create packages for platforms that require them (e.g., .APK on Android). Red also includes a fully reactive cross-platform GUI system based on an underlying reactive dataflow engine, a 2D drawing dialect comparable to SVG, compile-time and runtime macro support, and more than 40 standard datatypes.
The following is the list of Red's Goals as presented on the Software Freedom Day 2011:
The following commercial applications are currently developed on Red:
Red's development is planned to be done in two phases:
Red currently supports the following cross-compilation targets:
(Note: Presently, Red applications are 32-bit, but it is planned to switch to 64-bit in the future.)
The "Hello, World!" program in Red:
IMPORTANT: These are intended as syntax examples. Until Red has 64-bit support, the integer example will overflow a 32-bit integer very quickly. Changing that to `float!` will go farther, but these are merely to show the syntax of the language.
The following is a factorial example in Red:
factorial: func [x [integer!] ; Giving the type of an argument in Red is optional][either x = 0 [1][x * factorial x - 1]]
The following is the same factorial example in Red/System (in this very simple case, the source code is very similar to Red's version):
factorial: func [x [integer!] ; This is compulsory in Red/System return: [integer!] ; This is compulsory in Red/System][either x = 0 [1][x * factorial x - 1]]