REBOL, the Relative Expression Based Object Language (pronounced is a data exchange and programming language designed specifically for network communications and distributed computing. Its designer, Carl Sassenrath, calls it a 'messaging' language, and says this about it: "The main idea of REBOL is that it gets used for: server, client, communications between them, and storage on them. The power of REBOL comes from its unique integration of programming language concepts and meta-data language concepts. The ultimate goal of REBOL is to provide a new architecture for how information is stored, exchanged, and processed between all devices connected over the Internet. It [REBOL is meant to be used for the semantic exchange of information between people and machines."
REBOL/Command, which added strong encryption and ODBC access, was released in September 2000.
REBOL/View was released in April 2001, adding graphical capabilities on top of the core language.
REBOL/IOS, an extensible collaboration environment built with REBOL was released in August 2001.
The REBOL SDK, providing a choice of kernels to bind against, as well as a preprocessor, was released in December 2002.
It supports structured, functional, and prototype-based programming. REBOL is not a pure functional language; imperative programming is supported by using functions with side-effects; nor is it a pure object-oriented language, having non-object datatypes and support for other programming paradigms. REBOL is particularly well suited for Language Oriented Programming; more specifically Dialecting.
REBOL is dynamic, and dynamically typed (values are strongly typed, variables are not). It uses garbage collection for memory management, and supports exception handling and dynamic name resolution (through computed binding).
As a data language, REBOL data is comprised of strongly typed values; it supports more than 30 native data types. As in many programming languages, there are basic values like integers, decimal numbers, and strings. REBOL extends the range of datatypes identified by their lexical form to include values such as email addresses (name@host.dom), URLs (http://www.rebol.com), markup tags (<b>, <font size="2" color="blue">), money values ($100.00, USD$25.25), dates (30-Nov-2005, 1-Dec-2005/10:30-7:00), times (12:00:00), coordinate pairs (5x5), tuples (255.255.255, 192.168.100.1), and words (how are you?). These datatypes use lexical forms familiar to many non-programmers to facilitate its use as a data exchange language. REBOL's main data structure, used for grouping values, is a block!, which is somewhat comparable to a list in Lisp.
The source code of the REBOL interpreter is proprietary. Both REBOL/Core and REBOL/View have been made available for producing distributable commercial applications at no charge. Extended editions, such as REBOL/Pro, still require a paid license; they add features like ODBC data access, the ability to use dynamic link libraries, and the option to create standalone EXE files.
The runtime environment is currently stored in a single executable file. REBOL/Core, the console edition, is about 300kB and REBOL/View, the graphical user interface edition, is about 650kB in size. Application scripts are rarely more than a few kilobytes, so you can fit the interpreter and scripts on a single floppy disk, send application scripts in email messages, or run them over the Internet.
It contains support for many Internet protocols, making it easy to write internet applications such as electronic mail agents or web applications.
REBOL/View provides platform-independent graphics and sound access, and comes with its own windowing toolkit and extensible set of styles (UI widgets). With it, you can build distributed GUI applications. Due to REBOL's dialecting model, it is a lightweight solution for developing x-internet applications.
The REBOL community is linked through a "REBOL desktop", a graphical representation of REBOL-related files stored on the Internet that is installed together with the REBOL interpreter. The REBOL desktop itself is an open source REBOL application.
In the console, you can just type:
A cross-platform GUI version could be done like this:
view layout [ text "Hello world!" button "Quit" * ]
And here is a simple internet application that uses two internet services, HTTP and SMTP:
send branko@collin.example read http://www.rebol.com
The Header section, beginning with the word Rebol, is required in scripts so the interpreter knows where the script begins. The header need comprise only REBOL *; however, good practice encourages a verbose, descriptive header such as shown in the examples.
Dialects are usually implemented by functions processing REBOL blocks in a specific way (string processing can be used too, see examples below). Similarly, as with other functions, we can discern native dialects (implemented by native functions) and dialects written in REBOL.
Dialect examples:
A user can create dialects using any REBOL functions, but reduce and compose functions are better suited than other functions and the parse function is specifically optimized for that purpose.
The parse function's purpose is to analyse and interpret dialects by specifying parsing expression grammar rules in a BNF-like format, much as you would for a parser building tool like yacc or GNU bison. The rules are interpreted by REBOL at runtime. Actions can be included to be taken during the parsing process as well.
The parse function can be used to process REBOL blocks or REBOL strings.
Using parse against a string allows for near-complete flexibility, but requires more effort, as it is a lower level approach. Block parsing makes it easier to create dialects, but there is a tradeoff. In block parsing mode, REBOL handles the lexical scanning for you and your rules are written at the level of REBOL values, not characters and delimiters. The up-side to this is that you can write your rules at a much higher level of abstraction, but your data must fit within the standard REBOL lexical form.
Rather than try to cover all the details of writing dialects, I'll just provide a couple small examples:
foreach string strings [ print string ; Our rules go in a block, enclosed by square brackets parse string [ ; Each string should start with one of these words. COPY will ; copy the text of interest so we can use it later. copy how | "send" (print how) ; Now, copy everything up to the next space, which should ; then be followed by either "a" or "the". We use parenthesis ; to define actions to take when a rule succeeds. copy who to " " | "the" (print who) ; Finally, copy everything to the end of the string. copy what to end (print what) ] print "" ]
The dialect allows for multiple items, alternate word orders, and optional words that a person might include for readability, but which shouldn't affect the program's operation.
Here are two sets of commands users might send to the app:
foreach block command-blocks [ print mold block parse block [ some [ some * | some * | set when time! (print when) | opt 'results 'to set target url! (print target) | 'again | 'and ] to end ] print "" ]
In the example above, the file, email, time, and url values are all native datatypes in REBOL, so the values extracted during the parse operation could be directly applied in REBOL expressions. For example, the who value could be used with the send function to send email notifications, and the url value with the write function to post the data.
Prototype-based programming languages | Dynamic programming languages | Dynamically-typed programming languages | Functional languages | Scripting languages