Information AboutRebol |
| CATEGORIES ABOUT REBOL | |
| prototype-based programming languages | |
| dynamic programming languages | |
| dynamically-typed programming languages | |
| functional languages | |
| scripting languages | |
|
HISTORY First 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 utilizing concepts from the Lisp , Forth , and Logo programming languages. 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. THE LANGUAGE Programming REBOL is a High-level , Interpreted , Multi-platform , Multi-paradigm , Dynamically Reflective , symbolic Programming Language . It is also ''strongly homo-iconic''--meaning that code and data have the same representation--making it very suitable for Metaprogramming . 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 ). Data Definition and Exchange To support its use as a data exchange language, REBOL has minimal syntax with the following properties:
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. IMPLEMENTATION The REBOL interpreter is available in several editions (/Core, /View, /Command, /Base, /Face and /Pro). At the time of this writing the /Core version, which is a subset of all other versions except /Base, was available for 43 Platforms . 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 Kilobyte s, 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. EXAMPLES Hello World : In the console, you can just type: A cross-platform GUI version could be done like this: Title: "Hello World in a Window" File: %hello-view.r Date: 12-January-2002 ] view layout [ text "Hello world!" button "Quit" {Link without Title} ] And here is a simple internet application that uses two internet services, HTTP and SMTP : Title: "Web Page Emailer" File: %sendwebpage.r Date: 12-January-2002 Purpose: "Get an HTML document from the web and send it through e-mail" ] 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 {Link without Title} ; however, good practice encourages a verbose, descriptive header such as shown in the examples.DIALECTS REBOL is a context dependent language that provides support for domain-specific sublanguages called dialects. An example of REBOL's context sensitivity can be seen with the word ''return''. Under 'normal' evaluation, ''return'' exits a function passing back a result value. In the context of the ''Visual Interface Dialect'' (VID), an occurrence of the word ''return'' causes the layout engine to simulate a Carriage Return , moving the "rendering pen" down to the beginning of the next line. REBOL programmers can create their own dialects, reusing any existing REBOL word and giving it a different meaning in the context of that dialect. 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 Delimiter s. 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. Grammar Rules The rules you feed to the ''parse'' function are, themselves, written in a dialect of REBOL. When parsing strings, a subset of REBOL Datatype s can be used in rules; in block parsing mode, all REBOL datatypes can be used along with some other features that make building sophisticated dialects easier. Rather than try to cover all the details of writing dialects, I'll just provide a couple small examples: String Parsing Example This first example will parse a string, looking for some specific words, and copying parts of the data out which are variable, and that may be used elsewhere. In this example, all the parts copied from the string are, themselves, strings. "write Graham a thank-you note" "send Allen the new source code" ] 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 Who To " "
| ""a"" class="copylinks" target="_blank"> "the" (print who ) |
  |
| "'notify" class="copylinks" target="_blank">some [set who email! opt 'and (print who) ] |
  |
| "'at" class="copylinks" target="_blank">set when time! (print when) |
  |
| "'post" class="copylinks" target="_blank">opt 'results 'to set target url! (print target) |
|
|
|