R-SCRIPT

You can think of R-Script as Java-Lite; it nearly follows the same object-oriented methodology as Java and C++, but is design for the smaller programs that are typically written in a shell language such as Bourne/Korn and even Perl.  I began developing this language and its interpreter back in July 2001 to see if I could do it.  I completed a "concept" version of the language early 2002, so I'm left with the question of "now what?"  The concept version is functional with all the syntax defined in the manual, but it has not been fully tested nor has it been used in the field -- perhaps in the future I might integrate this project into another (my stock program perhaps?).  If you have questions or comments about this language, or you found some bugs in the Runner, you can email me at reymano@yahoo.com.

Programmer's Manual
Adobe Acrobat format.
Concept version,  Jan 2002.

Interpreter
Win32 Executable
Concept version, Jan 2002. 

Basics

To get a full description of the language, please read the programmer's manual.  I think the best way to demonstrate this language to jump right in with a few samples.  Let's start with the customary "Hello World" program:

Sample 1-1: Hello World

/* This is Hello World */

main()
{
    write "Hello World\n";  // I'm writing to standard output
}

It's as simple as that.  For you C++ and Java programmers, the basic syntax is the same: statements are terminated with a semi-colon, curly braces are used for denoting scope, and comments can be specified in block (/*,*/) or single-line (//) notation.  In addition, every ReyScript program must define a main function in the workspace (also known as the global class).  The write statement (along with its twin read) serves as the key I/O mechanism in the language.

Let's add some more stuff to this program:

Sample 1-2: Hello World Part 2

number a;

main()
{
    number b = 5;

    while(a<=b)

        write "Hello World " + a + "\n";
        a++;
    }
}

In this example, we see the use two of the language's primitive classes: number and string.  The variable "a" is defined as a number, but what is not clearly seen is that the constants "Hello World" and "\n" are resolved into string objects during execution.  Here's how the output to the program above.

Hello World 1
Hello World 2
Hello World 3
Hello World 4
Hello World 5

Our last sample in this section will show how classes can be used in conjunction with the read/write statements. This is just the tip of the iceberg.  Read the programmer's manual for more stuff.

Sample 1-3: Hello You

class user
{
    string username;

    ~read(stream x)
    {
        write ("What is your name? ") to x;
        read (username) from x;


    ~write(stream x)
    {
        write ("Hello " + username + "\n") to x;
    }
}

main()
{
    user a;

    read a;
    write a;
}

Here's how the output might look:

What is your name? Dave
Hello Dave

 

1