Red (programming language)
![]() | |
Paradigm | Multi-paradigm:imperative,functional,symbolic |
---|---|
Designed by | Nenad Rakočević[1] |
Developer | Nenad Rakočević |
First appeared | 2011 |
Stable release | |
OS | Linux,Windows,OS X |
License | modified BSDandBoost |
Filename extensions | .red,.reds |
Website | www |
Influenced by | |
Rebol,Lisp,Scala,Lua |
Redis aprogramming languagedesigned to overcome the limitations of the programming languageRebol.[3]Red was introduced in 2011 by Nenad Rakočević,[4]and is both animperativeandfunctional programminglanguage. Its syntax and general usage overlaps that of the interpreted Rebol language.[5]
The implementation choices of Red intend to create afull stackprogramming language:[4][6]Red can be used for extremely high-level programming (DSLsandGUIs) as well as low-level programming (operating systemsanddevice drivers). Key to the approach is that the language has two parts:Red/SystemandRed.[7]
- Red/Systemis similar to C, but packaged into a Rebol lexical structure – for example, one would write
ifx>y[print"Hello"]
instead ofif(x>y){printf("Hello\n");}
. - Redis ahomoiconic language,which is capable of meta-programming with Rebol-like semantics.[3][8]Red's runtime library is written in Red/System, and uses a hybrid approach: itcompileswhat it can deduce statically and uses an embeddedinterpreterotherwise. The project roadmap includes ajust-in-time compilerfor cases in between, but this has not yet been implemented.
Red seeks to remain independent of any othertoolchain;it does its own code generation.[3]It is therefore possible tocross-compile[6]Red programs from any platform it supports to any other, via a command-line switch. Both Red and Red/System are distributed asopen-source softwareunder themodified BSD license.The runtime library is distributed under the more permissiveBoost Software License.
As of version 0.6.4 Red includes agarbage collector"the Simple GC".[9]
Introduction[edit]
Red was introduced in theNetherlandsin February 2011 at theRebol & Boron conference[10]by its author Nenad Rakočević. In September 2011, the Red programming language was presented to a larger audience during theSoftware Freedom Day2011.[11][12]Rakočević is a long-time Rebol developer known as the creator of the CheyenneHTTP server.[13]
Features[edit]
Red's syntax and semantics are very close to those ofRebol.[4][14]Like Rebol, it strongly supportsmetaprogrammingand 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.[7]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).[7]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.
Goals[edit]
The following is the list of Red's Goals as presented on theSoftware Freedom Day2011:[11][12]
- Simplicity ( "An IDE should not be necessary to write code." )
- Compactness ( "Being highly expressive maximizes productivity." )
- Speed ( "If too slow, it cannot be general-purpose enough." )
- Be "Green", Have a Small Footprint ( "Because resources are not limitless." )
- Ubiquity ( "Spread everywhere." )
- Portability, Write once run everywhere ( "That's the least expected from a programming language." )
- Flexibility ( "Not best but good fit for any task!" )
Commercial applications[edit]
The following commercial applications are currently developed on Red:
Development[edit]
Red's development is planned to be done in two phases:
- Initial phase: Red and Red/System compilers written inRebol2
- Bootstrapphase: Red and Red/System compilers complemented by a Red JIT-compiler, all written in Red
Cross compilation[edit]
Red currently supports the following cross-compilation targets:[4]
- MS-DOS:Windows,x86,console (and GUI) applications
- Windows:Windows, x86, GUI applications
- Linux:Linux,x86
- Linux-ARM:Linux,ARMv5,armel(soft-float)
- Raspberry Pi:Linux,ARMv5,armhf(hard-float)
- FreeBSD:x86
- Darwin:OS XIntel, console (and GUI) applications
- Android:Android,ARMv5
- Android-x86: Android,x86
(Note: Presently, Red applications are 32-bit, but it is planned to switch to 64-bit in the future.[4])
Hello World![edit]
The"Hello, World!" programin Red:
Red[Title:"Simple hello world script"]
print"Hello, World!"
Factorial example[edit]
IMPORTANT: These are intended as syntax examples. Until Red has64-bitsupport, the integer example will overflow a32-bitinteger 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:
Red[Title:"A factorial script"];Note: The title is optional.
factorial:func[
x[integer!];Giving the type of an argument in Red is optional
][
eitherx=0[1][x*factorialx-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):
Red/System[Title:"A factorial script"]
factorial:func[
x[integer!];This is compulsory in Red/System
return:[integer!];This is compulsory in Red/System
][
eitherx=0[1][x*factorialx-1]
]
See also[edit]
- Comparison of programming languages
- History of programming languages
- List of programming languages
- List of programming languages by type
References[edit]
- ^"Creator of Red".GitHub.
- ^"Red's changelog".red-lang.RetrievedFebruary 21,2024.
- ^abc"Getting Started with GUI Programming using Red Language".Studytonight.RetrievedSeptember 17,2021.
- ^abcdeBalbaert 2018.
- ^"Interview with Nenad Rakocevic about Red, a Rebol inspired programming language".Not a Monad Tutorial.28 August 2015.RetrievedAugust 28,2015.
- ^ab"6 Unusual & Groundbreaking Programming Languages to Learn in 2023".makeuseof.com.18 October 2023.
- ^abcLucas, Mathis (21 July 2023)."Red: an imperative and functional programming language that is also a" full battery "language".Developpez.com.Retrieved16 January2023.
- ^Sasu, Alexandru (22 November 2018)."Review of Red".Softpedia.RetrievedFebruary 21,2024.
- ^lucindamichele."0.6.4 Simple GC and Pure Red GUI Console".Retrieved2018-12-16.
The main feature for 0.6.4 is what we call the Simple GC (Garbage Collector). A more advanced GC is planned for the future
- ^« New Red Programming Language Gets Syllable Backend »,osnews.com,May 2011.
- ^ab« Red Programming Language: Red at Software Freedom Day 2011 »,red-lang.org,September 14, 2011.
- ^ab"Software Freedom Day 2011: Red programming language, a new REBOL dialect".YouTube.Retrieved17 January2023.
- ^« What is Cheyenne? »Last referenced Nov 2017.
- ^"The Dynamic Mapping Architecture".OhioLINK.December 2021.
- ^«DiaGrammar»,red-lang.org,March 2020.
- ^«SmartXML»,redata.dev.
Further reading[edit]
- Balbaert, Ivo (May 2018).Learn Red - Fundamentals of Red.Packt Publishing.ASINB07C5X8Q32.ISBN978-1789130706.
External links[edit]
![](https://upload.wikimedia.org/wikipedia/en/thumb/4/4a/Commons-logo.svg/30px-Commons-logo.svg.png)
- Programming languages
- Systems programming languages
- Extensible syntax programming languages
- Domain-specific programming languages
- High-level programming languages
- Homoiconic programming languages
- Procedural programming languages
- Functional languages
- Cross-platform free software
- Cross-platform software
- Free compilers and interpreters
- Software using the BSD license
- Software using the Boost license
- Programming languages created in 2011
- 2011 software