Preface - Why Scriptol

Scriptol means for "Scriptwriter Oriented Language". It is intended to deliver programmers of any hardware constraint and to make a program as a scenario is written.
Scriptol may be embedded inside a HTML page and it is converted to the same page with PHP code, ready for the Net, under Windows or Unix or any other PHP compatible platform.
There are for now two compilers for the Scriptol programming language.
- Solp allows to interpret scriptol programs with the PHP interpreter.
- Solc compiles scriptol sources scriptol into C++ or builds directly executables for Windows or Unix.

Why Scriptol

This is because I was thinking that, in the 2001 year, language used by programmers should not be those designed in the 70 th for 1 mhz processors, that I have decided to create Scriptol, the implementation of which have been available late in 2001.
In these old languages, mainly designed to reduce compilation time, look-ahead of the parser was not more than three tokens, and that means syntax must be simple enough for each new statement of a program being identified by the compiler at the three first encountered symbols. Lastly proposed languages always keep the same kind of syntax, just for programmers not to change their habits!
But the Scriptol's parser can reach 20 levels of look-ahead, and nevertheless compiling is extremely fast.
Unlike in C++, statements and expressions are two different kinds of things in Scriptol, allowing for building extra control structures.

Old syntax and modern simplicity

 

This is an Algol program.
Algol has been designed in 1968.
// displaying Hello World
BEGIN
 FILE F (KIND=REMOTE);
 EBCDIC ARRAY E [0:11];
 REPLACE E BY "HELLO WORLD!";
 WHILE TRUE DO
 BEGIN
  WRITE (F, *, E);
 END;
END.
This is a "modern" delphi program.
cont str = 'Hello World!';
var i:int; len:int;
begin
  len:= length(str);
  for i:=0 to len do
    begin
       write(str[i]);
    end;
end;
This is the same program, rewritten in Scriptol.
constant text str = 'Hello World!'
for int i in 0 -- str.length()
  print str[i]
/for

Scriptol design

The design of the Scriptol language has been made with a rigourous method and not empirically by adding features from time to time, when needed. Seven rules have been defined to lead the design (look at the "seven" page on the site), and nothing has been included into the language that doesn't satisfy all the rules.
- I decided as first rule that the language must be simple, natural,
- and the second one is to suppress all causes of errors for the programmer.
- The third one is a rule of standardization: never use a new syntax if a previous one exists that is clear and convenient for its purpose.

Scriptol is as simple than modern scripting languages, most of them allowing to write directly in the program what one have in mind. It may be interpreted as a scripting language, but the Scriptol compiler can also build an executable you can distribute and that runs without the need for an interpreter...

Unlike scripting languages, it has typed variable for controls by the compiler, avoiding you to spend in debugging the time gained at writing!

Until now, a new language required starting from scratch and writing all the necessary libraries of functions. This drawback has been suppressed since Scriptol uses C++ as intermediate language, and thus C++ libraries may be linked directly to a Scriptol program! By using also PHP as alternate target language, Scriptol answers the need for an Internet language which, apart to be natural and easy to learn, performs complete error checking at compile time and not while running. Scriptol may be embedded inside a HTML page and it is converted to the same page with PHP code, ready for the Net, under Windows or Unix or any other PHP compatible platform.

A word about simplicity

Scriptol keeps the structure of XML or HTML in any structure of the language.
The C, Java, PHP languages usent { } symbols from C designed in 1972, symbols mainly convenient with old text editors. But this is obsolete.

The programmer is often obliged to add a comment to clarify the code:

while(x < 10)
{
   ...
} // end of while

It is simpler to write as in XML de XML:
while x < 10
  ...
/while

Syntax-highlighting in modern text editors (one is furnished on the CD), allows to locate easily the begin end end of the while structure.

Conclusion

Scriptol has extended features, going far away what any other scripting or application language implement yet and this extended tutorial will allow you to descover them.