First program

Scriptol sources files

A Scriptol source is just a set of statements written into a text file. For example, you can launch a text editor as Wordpad and type:

 print "hello" 

then save this text into a file with the "sol" extension, "hello.sol", for example, and you have a Scriptol source, ready to be compiled!

Compiling

This assumes you have installed the Scriptol and either the Php interpreter or a C++ compiler.
Read the install file for details.

The command line

To compile a Scriptol program, open a console (a Dos window under Windows) and enter the directory where Scriptol is installed. You have created the hello.sol program that is just one line:

 print hello 

To compile your Scriptol source and let the Php interpreter run it, type:

 solp hello 

The compiler adds the ".sol" extension, finds the "hello.sol" program. Then it searches for a "hello.php" target file. If it doesn't find one, or if the Scriptol source has been modified since the Php file has been generated, it compiles the source and call the Php interpreter.

To run the hello program again, type either:

solp hello

or

php -q hello.php

In the first case, if the program has been compiled without error, it is ran directly, otherwise it is compiled again. If errors are displayed you must modify the source and type the command again.

It is possible to run the program, even if it has errors, type:

 solp -r demo 

In the same manner, it is possible to force the compiler to compile:

solp -b demo. 

To build an executable, type:

solc hello 

The compiler compiles the Scriptol sources in C++, invoques the C++ compiler to make object files, link them and run the program.
Once it is compiled, type:

 hello 

to run it.

You can control the process with these options:
-c compile scriptol sources to C++ only.
-b build object files only.
-e link object file to make an executable.
-r run the executable.

Linked all together, thes options force the different phases:
solc -ber hello

Launching the compiler at command line

 

Using the Scite editor

It is more easy to edit and compile Scriptol program from the Scite editor, as the syntax is highlighted and options are inside a menu.
Main commands are
- compile into Php.
- interpret (and compile first into Php if required).
- compile into C++.
- build an executable.
- run the compiled binary.
The Xsolp ar Xsolc are for the enterprise edition.

 
Using the editor


Take note that command and colored syntax appears only if you have loaded a file with the .sol extension or save the current source with the .sol extension.
This is the same with a Php, C++, or html file.

Now you are ready to learn the powerful Scriptol programming language.


 Exercise

 

Run the editor, that is included in the archive, and type:

 print "Hello".

Click on the "interpret" command in the "Tools" menu, then build an executable to verify each thing is properly installed.