REBOL is a
cross-platformIn computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...
data exchange language and a
multi-paradigmProgramming languages can be grouped by the number and types of paradigms supported.-Paradigm summaries:A concise reference for the programming paradigms listed in this article....
dynamic programming languageDynamic programming language is a term used broadly in computer science to describe a class of high-level programming languages that execute at runtime many common behaviors that other languages might perform during compilation, if at all...
originally designed by
Carl SassenrathCarl Sassenrath is an architect of operating systems and computer languages. He brought multitasking to personal computers in 1985 with the creation of the Amiga Computer operating system kernel, and he is currently the designer of the REBOL computer language as well as the CTO of REBOL...
for network communications and
distributed computingDistributed computing is a field of computer science that studies distributed systems. A distributed system consists of multiple autonomous computers that communicate through a computer network. The computers interact with each other in order to achieve a common goal...
. The language and its official implementation, which is a proprietary
freely redistributable softwareFreely redistributable software is software that anyone is free to redistribute. The term has been used to mean two types of free to redistribute software, distinguished by the legal modifiability and limitations on purpose of use of the software. FRS which can be legally modified and used for any...
are developed by REBOL Technologies. REBOL Technologies also claims the name REBOL as a trademark.
Douglas CrockfordDouglas Crockford is an American computer programmer and entrepreneur, best known for his ongoing involvement in the development of the JavaScript language, and for having popularized the data format JSON , and for developing JSLint...
of
JavaScriptJavaScript is a prototype-based scripting language that is dynamic, weakly typed and has first-class functions. It is a multi-paradigm language, supporting object-oriented, imperative, and functional programming styles....
fame has described REBOL as "a more modern language, but with some very similar ideas to Lisp, in that it's all built upon a representation of data which is then executable as programs.", and as one of the
JSONJSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...
influences.
REBOL introduces the concept of
dialectingDialects are domain specific sub-languages of a programming language or a data exchange language. A language supporting this paradigm encourages users to create new dialects for specific problematic domains.- Languages :* FORTH* LISP* REBOL* Ruby* XL- See also :* Domain-specific...
: small,
optimizedIn computer science, program optimization or software optimization is the process of modifying a software system to make some aspect of it work more efficiently or use fewer resources...
, domain-specific languages for code and data, which is also the most notable property of the language according to its designer:
REBOL has been used to program
InternetThe Internet is a global system of interconnected computer networks that use the standard Internet protocol suite to serve billions of users worldwide...
applicationApplication software, also known as an application or an "app", is computer software designed to help the user to perform specific tasks. Examples include enterprise software, accounting software, office suites, graphics software and media players. Many application programs deal principally with...
s (both
client-Client-side refers to operations that are performed by the client in a client–server relationship in a computer network.Typically, a client is a computer application, such as a web browser, that runs on a user's local computer or workstation and connects to a server as necessary...
and
server-sideServer-side refers to operations that are performed by the server in a client–server relationship in computer networking.Typically, a server is a software program, such as a web server, that runs on a remote server, reachable from a user's local computer or workstation...
),
databaseA database is an organized collection of data for one or more purposes, usually in digital form. The data are typically organized to model relevant aspects of reality , in a way that supports processes requiring this information...
applications,
utilitiesUtility software is system software designed to help analyze, configure, optimize or maintain a computer. A single piece of utility software is usually called a utility or tool....
, and
multimediaMultimedia is media and content that uses a combination of different content forms. The term can be used as a noun or as an adjective describing a medium as having multiple content forms. The term is used in contrast to media which use only rudimentary computer display such as text-only, or...
applications.
History
First released in 1997, REBOL was designed over a 20 year period by Carl Sassenrath, the architect and primary developer of
AmigaOSAmigaOS is the default native operating system of the Amiga personal computer. It was developed first by Commodore International, and initially introduced in 1985 with the Amiga 1000...
, based on his study of
denotational semanticsIn computer science, denotational semantics is an approach to formalizing the meanings of programming languages by constructing mathematical objects which describe the meanings of expressions from the languages...
and using concepts from the programming languages Lisp, Forth,
LogoLogo is a multi-paradigm computer programming language used in education. It is an adaptation and dialect of the Lisp language; some have called it Lisp without the parentheses. It was originally conceived and written as functional programming language, and drove a mechanical turtle as an output...
, and Self.
REBOL Technologies was founded in 1998.
REBOL 2, the interpreter, which became the core of extended interpreter editions, was first released in 1999.
REBOL/Command, which added strong encryption and
ODBCIn computing, ODBC is a standard C interface for accessing database management systems . The designers of ODBC aimed to make it independent of database systems and operating systems...
access, was released in September 2000.
REBOL/View was released in April 2001, adding graphical abilities on the core language.
REBOL/IOS, an extensible collaboration environment built with REBOL was released in August 2001.
REBOL/SDK, providing a choice of kernels to bind against, as well as a preprocessor, was released in December 2002.
REBOL 3, the newest version of the REBOL
interpreterIn computer science, an interpreter normally means a computer program that executes, i.e. performs, instructions written in a programming language...
, is currently in development. Alpha versions have been released publicly since January 2008.
Dialects
REBOL dialects, now popular as domain-specific languages (DSLs), are micro-languages optimized for a specific purpose. Dialects can be used to define business rules, graphical user interfaces or sequences of screens during the installation of a program. Users can define their own dialects, reusing any existing REBOL word and giving it a specific meaning in that dialect. Dialects are
interpretedInterpreted language is a programming language in which programs are 'indirectly' executed by an interpreter program. This can be contrasted with a compiled language which is converted into machine code and then 'directly' executed by the host CPU...
by functions processing REBOL blocks (or parsing strings) in a specific way.
An example of REBOL's dialecting abilities can be seen with the word
return. In the
data exchange dialect return is just a word not having any specific meaning. In the
do dialect,
return is a
global variableIn computer programming, a global variable is a variable that is accessible in every scope . Interaction mechanisms with global variables are called global environment mechanisms...
referring to a native function passing back a function result value. In the
visual interface dialect (VID),
return is a
keywordIn computer programming, a keyword is a word or identifier that has a particular meaning to the programming language. The meaning of keywords — and, indeed, the meaning of the notion of keyword — differs widely from language to language....
causing the layout engine to simulate a
carriage returnCarriage return, often shortened to return, refers to a control character or mechanism used to start a new line of text.Originally, the term "carriage return" referred to a mechanism or lever on a typewriter...
, moving the "rendering pen" down to the beginning of the next line.
A REBOL interpreter with graphical abilities must understand and interpret many dialects. The table below lists the most important ones in order of significance.
| Dialect name |
Interpreted by |
Purpose |
| Data exchange dialect |
load function |
represents data and metadata; common platform for REBOL dialects |
| Do dialect |
do function |
programming |
| Parse dialect |
parse function |
pattern matching In computer science, pattern matching is the act of checking some sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact. The patterns generally have the form of either sequences or tree structures...
|
| Function specification dialect |
make function |
function definition; functional programming In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...
|
| Object specification dialect |
make function |
object In computer science, an object is any entity that can be manipulated by the commands of a programming language, such as a value, variable, function, or data structure... definition/inheritance; prototype-based programmingPrototype-based programming is a style of object-oriented programming in which classes are not present, and behavior reuse is performed via a process of cloning existing objects that serve as prototypes. This model can also be known as classless, prototype-oriented or instance-based programming...
|
Visual interface dialect (VID) or RebGUI |
layout function or display function |
specifies graphical user interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
|
| Draw dialect |
view function |
defines graphical elements (lines, polygons, etc.) |
| Script specification dialect |
do function |
script definition |
| Security policy dialect |
secure function |
specifies security policy |
Syntax
REBOL syntax is
free-formIn computer programming, a free-form language is a programming language in which the positioning of characters on the page in program text is not significant. Program text does not need to be placed in specific columns as on old punched card systems, and frequently ends of lines are not significant...
, not requiring specific positioning. However,
indentationIn computer programming, an indent style is a convention governing the indentation of blocks of code to convey the program's structure. This article largely addresses the C programming language and its descendants, but can be applied to most other programming languages...
is recommended to better convey the structure of the text to human readers.
Syntactic properties of different dialects may differ. The common platform for all REBOL dialects is the
data exchange dialect; other dialects are usually derived from it. In addition to being the common platform for all dialects, the
data exchange dialect is directly used to represent data and metadata, populate data structures, send data over Internet, and save them in data storage.
In contrast to programming languages like
CC is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
, the
data exchange dialect does not consist of
declarationsIn programming languages, a declaration specifies the identifier, type, and other aspects of language elements such as variables and functions. It is used to announce the existence of the element to the compiler; this is important in many strongly-typed languages that require variables and their...
,
statementIn computer programming a statement can be thought of as the smallest standalone element of an imperative programming language. A program written in such a language is formed by a sequence of one or more statements. A statement will have internal components .Many languages In computer programming...
s,
expressionsAn expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces another value...
or keywords. A valid
data exchange dialect text stream is a tree data structure consisting of blocks (the root block is implicit, subblocks are
delimitedA delimiter is a sequence of one or more characters used to specify the boundary between separate, independent regions in plain text or other data streams. An example of a delimiter is the comma character, which acts as a field delimiter in a sequence of comma-separated values.Delimiters represent...
by
square bracketsBrackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. In the United States, "bracket" usually refers specifically to the "square" or "box" type.-List of types:...
), parens (delimited by
round bracketsBrackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. In the United States, "bracket" usually refers specifically to the "square" or "box" type.-List of types:...
),
stringsIn formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....
(delimited by
double quotesDifferent typefaces, character encodings and computer languages use various encodings and glyphs for quotation marks. This article lists some of these glyphs along with their Unicode code points and HTML entities...
or
curly bracketsBrackets are tall punctuation marks used in matched pairs within text, to set apart or interject other text. In the United States, "bracket" usually refers specifically to the "square" or "box" type.-List of types:...
suitable for multi-line strings;
caret notationCaret notation is a notation for unprintable control characters in ASCII encoding. The notation consists of a caret followed by a capital letter; this digraph stands for the ASCII code that has the numerical value equivalent to the letter's numerical value. For example the EOT character with a...
is used for unprintable characters),
URLsIn computing, a uniform resource locator or universal resource locator is a specific character string that constitutes a reference to an Internet resource....
, e-mail addresses, files, paths or other
composite valuesIn computing, a scalar variable or field is one that can hold only one value at a time; as opposed to composite variables like array, list, hash, record, etc. In some contexts, a scalar value may be understood to be numeric. A scalar data type is the type of a scalar variable...
. Unlike
ALGOLALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
blocks, REBOL blocks are composite values similar to quoted
s-expressionS-expressions or sexps are list-based data structures that represent semi-structured data. An S-expression may be a nested list of smaller S-expressions. S-expressions are probably best known for their use in the Lisp family of programming languages...
s in Lisp.
Blocks as well as parens may contain other composite values (a block may contain subblocks, parens, strings, ...) or
scalar valuesIn computing, a scalar variable or field is one that can hold only one value at a time; as opposed to composite variables like array, list, hash, record, etc. In some contexts, a scalar value may be understood to be numeric. A scalar data type is the type of a scalar variable...
like words, set-words (words suffixed by the
colonThe colon is a punctuation mark consisting of two equally sized dots centered on the same vertical line.-Usage:A colon informs the reader that what follows the mark proves, explains, or lists elements of what preceded the mark....
), get-words (words prefixed by the colon), lit-words (words prefixed by the apostrophe), numbers, money,
charactersA character encoding system consists of a code that pairs each character from a given repertoire with something else, such as a sequence of natural numbers, octets or electrical pulses, in order to facilitate the transmission of data through telecommunication networks or storage of text in...
, etc., separated by
whitespaceIn computer science, whitespace is any single character or series of characters that represents horizontal or vertical space in typography. When rendered, a whitespace character does not correspond to a visual mark, but typically does occupy an area on a page...
. Note that special characters are allowed in words, so
a+b is a word unlike
a + b, which is a sequence of three words separated by spaces.
CommentIn computer programming, a comment is a programming language construct used to embed programmer-readable annotations in the source code of a computer program. Those annotations are potentially significant to programmers but typically ignorable to compilers and interpreters. Comments are usually...
s may appear following the
semicolonThe semicolon is a punctuation mark with several uses. The Italian printer Aldus Manutius the Elder established the practice of using the semicolon to separate words of opposed meaning and to indicate interdependent statements. "The first printed semicolon was the work of ... Aldus Manutius"...
until the end of the line. Multi-line comments or comments not ignored by the lexical parser can be written using "ordinary" datatypes like multi-line strings.
Semantics
Blocks containing domain-specific language can be submitted as arguments to specific
evaluator functions.
do
The most frequently used evaluator is the
do function. It is used by default to interpret the text input to the interpreter console.
The
do dialect interpreted by the
do function, is an
expression-orientedAn expression-oriented programming language is a programming language where every construction is an expression and thus yields a value. The typical exceptions are macro definitions, preprocessor commands, and declarations, which expression-oriented languages often treat as statements rather than...
sublanguage of the
data exchange dialect. The main semantic unit of the language is the
expressionAn expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces another value...
. In contrast to imperative programming languages descending from
ALGOLALGOL is a family of imperative computer programming languages originally developed in the mid 1950s which greatly influenced many other languages and became the de facto way algorithms were described in textbooks and academic works for almost the next 30 years...
, the
do dialect has neither keywords, nor statements.
Words are used as
case-insensitiveText sometimes exhibits case sensitivity; that is, words can differ in meaning based on differing use of uppercase and lowercase letters. Words with capital letters do not always have the same meaning when written with lowercase letters....
variablesIn computer programming, a variable is a symbolic name given to some known or unknown quantity or information, for the purpose of allowing the name to be used independently of the information it represents...
. Like in all dynamically typed languages, variables don't have an associated type, type is associated with values. The result, i.e. the evaluation of a word is returned, when a word is encountered by the
do function. The set-word form of a word can be used for
assignmentIn computer programming, an assignment statement sets or re-sets the value stored in the storage location denoted by a variable name. In most imperative computer programming languages, assignment statements are one of the basic statements...
. While not having statements, assignment, together with functions with side-effects can be used for
imperative programmingIn computer science, imperative programming is a programming paradigm that describes computation in terms of statements that change a program state...
.
Subblocks of the root block evaluate to themselves. This property is used to handle data blocks, for
structured programmingStructured programming is a programming paradigm aimed on improving the clarity, quality, and development time of a computer program by making extensive use of subroutines, block structures and for and while loops - in contrast to using simple tests and jumps such as the goto statement which could...
by submitting blocks as arguments to
controlIn computer science, control flow refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are executed or evaluated....
functions like
if,
either,
loop, etc., and for dialecting, when a block is passed to a specific interpreter function.
A specific problem worth noting is, that composite values, assigned to variables, are not copied. To make a copy, the value must be passed to the
copy function.
The
do function normally follows a
prefix style of evaluationPolish notation, also known as prefix notation, is a form of notation for logic, arithmetic, and algebra. Its distinguishing feature is that it places operators to the left of their operands. If the arity of the operators is fixed, the result is a syntax lacking parentheses or other brackets that...
, where a function processes the arguments that follow it. However,
infix evaluationInfix notation is the common arithmetic and logical formula notation, in which operators are written infix-style between the operands they act on . It is not as simple to parse by computers as prefix notation or postfix notation Infix notation is the common arithmetic and logical formula notation,...
using infix
operatorProgramming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
s exists too. Infix evaluation takes precedence over the prefix evaluation. For example,
abs -2 + 3
returns 1, since the infix addition takes precedence over the computation of the absolute value. When evaluating infix expressions, the order of evaluation is left to right, no operator takes
precedenceIn mathematics and computer programming, the order of operations is a rule used to clarify unambiguously which procedures should be performed first in a given mathematical expression....
over another. For example,
2 + 3 * 4
returns 20, while an evaluation giving precedence to multiplication would yield 14. All operators have prefix versions.
Do usually evaluates arguments before passing them to a function. So, the below expression:
print read http://en.wikipedia.org/wiki/REBOL
first reads
http://en.wikipedia.org/wiki/REBOL and then passes the result to the
print function. Parentheses can be used to change the order of evaluation. Using
prefix notationPolish notation, also known as prefix notation, is a form of notation for logic, arithmetic, and algebra. Its distinguishing feature is that it places operators to the left of their operands. If the arity of the operators is fixed, the result is a syntax lacking parentheses or other brackets that...
, the usage of parentheses in expressions can be avoided.
The simple precedence rules are both an advantage:
- No need to "consult" precedence tables when writing expressions
- No need to rewrite precedence tables when a new operator is defined
- Expressions can be easily transliterated
Transliteration is a subset of the science of hermeneutics. It is a form of translation, and is the practice of converting a text from one script into another...
from infix to prefix notation and vice versa
as well as a disadvantage:
- Users accustomed to more conventional precedence rules may easily make a mistake
parse
The
parse function is preferably used to specify, validate, transform and interpret dialects. It does so by matching
parse expressions at run time.
Parse expressions are written in the
parse dialect, which, like the
do dialect, is an expression-oriented sublanguage of the
data exchange dialect. Unlike the
do dialect, the
parse dialect uses keywords representing operators and the most important nonterminals, infix parsing operators don't have prefix equivalents and use precedence rules (
sequence has higher precedence than
choice).
Actions can be included to be taken during the parsing process as well and the
parse function can be used to process blocks or strings. At the
string parsing level
parse must handle the "low level" parsing, taking into account
charactersIn computer and machine-based telecommunications terminology, a character is a unit of information that roughly corresponds to a grapheme, grapheme-like unit, or symbol, such as in an alphabet or syllabary in the written form of a natural language....
and delimiters.
Block parsing is higher level, handling the scanning at the level of REBOL values.
The parse dialect belongs to the family of grammars represented by the
top-down parsing languageTop-Down Parsing Language is a type of analytic formal grammar developed by Alexander Birman in the early 1970s in order to study formally the behavior of a common class of practical top-down parsers that support a limited form of backtracking...
or the
parsing expression grammarA parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language...
. The main similarity is the presence of the
sequence and
choice operators all the family members have. Parse dialect syntax and the similarities between the parse dialect and the PEG are illustrated by this transliteration of a PEG example that parses an arithmetic expression:
Digit: charset [#"0" - #"9"]
Value: [some Digit | "(" Expr ")"]
Product: [Value any "/"] Value
Sum: [Product any "-"] Product
Expr: Sum
parse/all "12+13" Expr
Ease of use
One of the REBOL design principles is "to do simple things in simple ways". In the following example the
Visual interface dialect is used to describe a simple
Hello world programA "Hello world" program is a computer program that outputs "Hello world" on a display device. Because it is typically one of the simplest programs possible in most programming languages, it is by tradition often used to illustrate to beginners the most basic syntax of a programming language, or to...
with a graphical user interface:
view layout [text "Hello world!" button "Quit" [quit]]
Implementations
The official REBOL
implementationImplementation is the realization of an application, or execution of a plan, idea, model, design, specification, standard, algorithm, or policy.-Computer Science:...
is a proprietary,
freely redistributableFreely redistributable software is software that anyone is free to redistribute. The term has been used to mean two types of free to redistribute software, distinguished by the legal modifiability and limitations on purpose of use of the software. FRS which can be legally modified and used for any...
interpreter available in several editions (
/Core,
/View,
/Command,
/SDK and
/IOS). Reverse engineering of the interpreter is forbidden by the license. Parts of the interpreter are
open sourceThe term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...
. Example: the
REBOL desktopIn graphical computing, a desktop environment commonly refers to a style of graphical user interface derived from the desktop metaphor that is seen on most modern personal computers. These GUIs help the user in easily accessing, configuring, and modifying many important and frequently accessed...
is an open source part of the
REBOL/View interpreter linking the REBOL community on the Internet. 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 interfaceIn computing, a graphical user interface is a type of user interface that allows users to interact with electronic devices with images rather than text commands. GUIs can be used in computers, hand-held devices such as MP3 players, portable media players or gaming devices, household appliances and...
edition, is about 650kB in size.
REBOL/View provides
platform-independentIn computing, cross-platform, or multi-platform, is an attribute conferred to computer software or computing methods and concepts that are implemented and inter-operate on multiple computer platforms...
graphics and sound access, and comes with its own windowing toolkit and extensible set of styles (GUI widgets). Extended editions, such as
REBOL/Command or
REBOL/SDK require a paid license; they add features like ODBC data access, and the option to create standalone executable files.
There are also
free softwareFree software, software libre or libre software is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with restrictions that only ensure that further recipients can also do...
/ open source alternatives to the REBOL interpreter (or parts of it), which are written as implementations of REBOL dialects.
- Orca is "an interpreter for a REBOL-like language". Orca is written in C
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
, but cannot be compiled without a REBOL interpreter being installed (Orca can be used when available).
- Boron is a C library which may be copied under the terms of the LGPLv3. It is an interpreter of a REBOL dialect. The Boron dialect is an interpreted, homoiconic language, which is meant for embedding domain specific languages.
- The Red/System compiler implements a REBOL dialect. It is currently bootstrapped using a REBOL interpreter and therefore needs a REBOL interpreter to run.
- The RebGUI dialect is an open alternative to REBOL/View's VID dialect for graphical user interfaces.
See also
- Dialecting
Dialects are domain specific sub-languages of a programming language or a data exchange language. A language supporting this paradigm encourages users to create new dialects for specific problematic domains.- Languages :* FORTH* LISP* REBOL* Ruby* XL- See also :* Domain-specific...
- Domain-specific language
- Language-oriented programming
Language oriented programming is a style of computer programming in which, rather than solving problems in general-purpose programming languages, the programmer creates one or more domain-specific languages for the problem first, and solves the problem in those languages...
- Parsing expression grammar
A parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language...
- Pattern matching
In computer science, pattern matching is the act of checking some sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact. The patterns generally have the form of either sequences or tree structures...
- Polish notation
Polish notation, also known as prefix notation, is a form of notation for logic, arithmetic, and algebra. Its distinguishing feature is that it places operators to the left of their operands. If the arity of the operators is fixed, the result is a syntax lacking parentheses or other brackets that...
External links