Rebol
Rebol (/หrษbษl/ REB-ษl; historically REBOL) is a cross-platform[6] data exchange language and a multi-paradigm dynamic programming language designed by Carl Sassenrath for network communications and distributed computing. It introduces the concept of dialecting: small, optimized, domain-specific languages for code and data,[6][7] which is also the most notable property of the language according to its designer Carl Sassenrath:
Douglas Crockford, known for his involvement in the development of JavaScript, 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 JSON's influences.[5] Originally, the language and its official implementation were proprietary and closed source, developed by REBOL Technologies. Following discussion with Lawrence Rosen,[9] the Rebol version 3 interpreter was released under the Apache 2.0 license on December 12, 2012.[10] Older versions are only available in binary form, and no source release for them is planned. Rebol has been used to program Internet applications (both client- and server-side), database applications, utilities, and multimedia applications.[6] EtymologyRebol was initially an acronym for Relative Expression Based Object Language written in all caps.[6][8] To align with modern trends in language naming represented, e.g. by the change replacing historical name LISP by Lisp, programmers ceased the practice of writing REBOL in all caps. Sassenrath eventually put the naming question to the community debate on his blog.[11] In subsequent writing, Sassenrath adopted the convention of writing the language name as Rebol.[12] HistoryFirst released in 1997, Rebol was designed over a 20-year period by Carl Sassenrath, the architect and primary developer of AmigaOS, based on his study of denotational semantics and using concepts from the programming languages Lisp, Forth, Logo, and Self.
DesignEase of useOne of the Rebol design principles is "to do simple things in simple ways".[6] In the following example the Visual interface dialect is used to describe a simple Hello world program with a graphical user interface: view layout [text "Hello world!" button "Quit" [quit]]
This is how a similar example looks in R3-GUI: view [text "Hello world!" button "Quit" on-action [quit]]
DialectsRebol domain-specific languages, called dialects, 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.[6] Dialects are interpreted 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 A Rebol interpreter with graphical abilities must understand and interpret many dialects. The table below lists the most important ones in order of significance.
SyntaxRebol syntax is free-form, not requiring specific positioning. However, indentation is often used 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 C, the data exchange dialect does not consist of declarations, statements, expressions or keywords. A valid data exchange dialect text stream is a tree data structure consisting of blocks (the root block is implicit, subblocks are delimited by square brackets), parens (delimited by round brackets), strings (delimited by double quotes or curly brackets suitable for multi-line strings; caret notation is used for unprintable characters), URLs, e-mail addresses, files, paths or other composite values. Unlike ALGOL blocks, Rebol blocks are composite values similar to quoted s-expressions in Lisp. The fact that code is written in the form of Rebol blocks makes the language homoiconic.[4] Blocks as well as parens may contain other composite values (a block may contain subblocks, parens, strings, ...) or scalar values like words, set-words (words suffixed by the colon), get-words (words prefixed by the colon), lit-words (words prefixed by the apostrophe), numbers, money, characters, etc., separated by whitespace. Special characters are allowed in words, so Comments may appear following the semicolon 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.[4] SemanticsBlocks containing domain-specific language can be submitted as arguments to specific evaluator functions.[6] doThe most frequently used evaluator is the The do dialect interpreted by the Words are used as case-insensitive variables. 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 Subblocks of the root block evaluate to themselves. This property is used to handle data blocks, for structured programming by submitting blocks as arguments to control functions like 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 The 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 precedence over another. For example, 2 + 3 * 4
returns 20, while an evaluation giving precedence to multiplication would yield 14. All operators have prefix versions. print read http://en.wikipedia.org/wiki/Rebol first reads the Wikipedia Rebol page and then passes the result to the The simple precedence rules are both an advantage:
as well as a disadvantage:
parseThe 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).[6] Actions can be included to be taken during the parsing process as well and the The parse dialect belongs to the family of grammars represented by the top-down parsing language or the parsing expression grammar (PEG). 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
ImplementationsThe official Rebol 2.7.8 implementation is available in several editions (/Core, /View, /Command, /SDK and /IOS). Both /Core and /View editions are freely redistributable software.[1] The runtime environment is stored in a single executable file. Rebol/Core 2.7.8, the console edition, is about 300 KB and Rebol/View 2.7.8, the graphical user interface edition, is about 650 KB in size. Rebol/View provides platform-independent graphics and sound access, and comes with its own windowing toolkit and extensible set of styles (GUI widgets). Extended editions, such as Rebol/Command 2.7.8 or Rebol/SDK 2.7.8 require a paid license; they add features like ODBC data access, and the option to create standalone executable files.[citation needed] Legacy
See alsoReferences
Further reading
External links |