HOME

TheInfoList



OR:

Red is a
programming language A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language. The description of a programming ...
designed to overcome the limitations of the programming language Rebol. Red was introduced in 2011 by Nenad Rakočević, and is both an imperative and
functional programming In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions tha ...
language. Its syntax and general usage overlaps that of the interpreted Rebol language. The implementation choices of Red intend to create a full stack programming language: Red can be used for extremely high-level programming ( DSLs and
GUI The GUI ( "UI" by itself is still usually pronounced . or ), graphical user interface, is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, inste ...
s) as well as low-level programming (
operating system An operating system (OS) is system software that manages computer hardware, software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ef ...
s and
device driver In computing, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabling operating systems and o ...
s). Key to the approach is that the language has two parts: ''Red/System'' and ''Red''. * ''Red/System'' is similar to C, but packaged into a Rebol lexical structure for example, one would write instead of . * ''Red'' is a homoiconic language capable of meta-programming, with Rebol-like semantics. Red's runtime library is written in Red/System, and uses a hybrid approach: it compiles what it can deduce statically and uses an embedded interpreter otherwise. The project roadmap includes a
just-in-time compiler In computing, just-in-time (JIT) compilation (also dynamic translation or run-time compilations) is a way of executing computer code that involves compilation during execution of a program (at run time) rather than before execution. This may c ...
for cases in between, but this has not yet been implemented. Red seeks to remain independent of any other toolchain; it does its own code generation. It is therefore possible to cross-compile 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 Open-source software (OSS) is computer software that is released under a license in which the copyright holder grants users the rights to use, study, change, and distribute the software and its source code to anyone and for any purpose. ...
under the modified BSD license. The runtime library is distributed under the more permissive
Boost Software License Boost is a set of libraries for the C++ programming language that provides support for tasks and structures such as linear algebra, pseudorandom number generation, multithreading, image processing, regular expressions, and unit testing. It ...
. As of version 0.6.4 Red includes a
garbage collector A waste collector, also known as a garbageman, garbage collector, trashman (in the US), binman or (rarely) dustman (in the UK), is a person employed by a public or private enterprise to collect and dispose of municipal solid waste (refuse) and ...
"the Simple GC".


Introduction

Red was introduced in the
Netherlands ) , anthem = ( en, "William of Nassau") , image_map = , map_caption = , subdivision_type = Sovereign state , subdivision_name = Kingdom of the Netherlands , established_title = Before independence , established_date = Spanish Netherl ...
in February 2011 at the ''Rebol & Boron conference'' 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. Rakočević is a long-time Rebol developer known as the creator of the Cheyenne HTTP server.« What is Cheyenne? »
Last referenced Nov 2017.


Features

Red's syntax and semantics are very close to those of Rebol. 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.


Goals

The following is the list of Red's Goals as presented on the Software Freedom Day 2011: * 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!")


Development

Red's development is planned to be done in two phases: # Initial phase: Red and Red/System compilers written in Rebol 2 # Bootstrap phase: Red and Red/System compilers complemented by a Red JIT-compiler, all written in Red


Cross compilation

Red currently supports the following cross-compilation targets: *
MS-DOS MS-DOS ( ; acronym for Microsoft Disk Operating System, also known as Microsoft DOS) is an operating system for x86-based personal computers mostly developed by Microsoft. Collectively, MS-DOS, its rebranding as IBM PC DOS, and a few o ...
: Windows, x86, console (and GUI) applications *
Windows Windows is a group of several proprietary graphical operating system families developed and marketed by Microsoft. Each family caters to a certain sector of the computing industry. For example, Windows NT for consumers, Windows Server for se ...
: Windows, x86, GUI applications *
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
:
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, x86 * Linux-ARM:
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, ARMv5,
armel Armel may refer to: *Armel, Virginia, unincorporated community in Frederick County, Virginia, United States *Saint Armel Saint Armel ( cy, Arthfael,  "Wolf-Prince"; la, Armagilus) was an early 6th-century holy man in Brittany. Armel is sai ...
(soft-float) * Raspberry Pi:
Linux Linux ( or ) is a family of open-source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged as a Linux distribution, whi ...
, ARMv5, armhf (hard-float) *
FreeBSD FreeBSD is a free and open-source Unix-like operating system descended from the Berkeley Software Distribution (BSD), which was based on Research Unix. The first version of FreeBSD was released in 1993. In 2005, FreeBSD was the most popular ...
: x86 * Darwin:
OS X macOS (; previously OS X and originally Mac OS X) is a Unix operating system developed and marketed by Apple Inc. since 2001. It is the primary operating system for Apple's Mac computers. Within the market of desktop and la ...
Intel, console (and GUI) applications *
Syllable A syllable is a unit of organization for a sequence of speech sounds typically made up of a syllable nucleus (most often a vowel) with optional initial and final margins (typically, consonants). Syllables are often considered the phonological ...
: Syllable OS, x86 * Android: Android, ARMv5 * Android-x86: Android, x86 (Note: This list will increase with time and should therefore be considered as incomplete.)


Hello World!

Red itle: "Simple hello world script"print "Hello World!"


Factorial example

IMPORTANT: These are intended as syntax examples. Until Red has
64-bit In computer architecture, 64-bit integers, memory addresses, or other data units are those that are 64 bits wide. Also, 64-bit CPUs and ALUs are those that are based on processor registers, address buses, or data buses of that size. A ...
support, the integer example will overflow a
32-bit In computer architecture, 32-bit computing refers to computer systems with a processor, memory, and other major system components that operate on data in 32- bit units. Compared to smaller bit widths, 32-bit computers can perform large calculati ...
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: Red itle: "A factorial script" ; Note: The title is optional. factorial: func x_[integer!_;_Giving_the_type_of_an_argument_in_Red_is_optional .html" ;"title="nteger!.html" ;"title=" x [integer!"> x [integer! ; Giving the type of an argument in Red is optional ">nteger!.html" ;"title=" x [integer!"> 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): Red/System itle: "A factorial script" factorial: func x_______[integer!__________________;_This_is_compulsory_in_Red/System return:_[integer!.html" ;"title="nteger!.html" ;"title=" x [integer!"> x [integer! ; This is compulsory in Red/System return: [integer!">nteger!.html" ;"title=" x [integer!"> x [integer! ; This is compulsory in Red/System return: [integer! ; This is compulsory in Red/System ][ either x = 0 [1][x * factorial x - 1] ]


See also

* Rebol


References


External links

*
Red Programming Language
on
GitHub GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, cont ...

Redprogramming.com
* {{Programming languages Functional languages Systems programming languages Extensible syntax programming languages Domain-specific programming languages Software using the BSD license Software using the Boost license Programming languages created in 2011 2011 software High-level programming languages Homoiconic programming languages