Scriptol Compilers: Frequently Asked Questions

The Scriptol language

Scriptol and PHP

Scriptol and C++


Extensions

Tools

Marketing

 

Can I call the constructor of the base class?

I inherit the class Car of the class Vehicle, for example. Can I call the constructor of Vehicle, from the constructor of Car? I do that in Java.

Java has the "super" keyword to call the constructor of a class from the constructor of an inherited class.
There is no equivalent in Scriptol. If you call the constructor of the base class, this create a new instance of the base class. But you can assign the attributes of the base class from the constructor of the inherited class.

A super statement was added to Scriptol 2 in 2014. It allow to pass parameters to the constructor of the upper class.

 

My program is not compiled (the C++ code)

I have prepared a simple file called register.sol, but when I invoke solc, I get the following errors:
C:\Archivos de programa\scriptol
>solc -be register.sol Scriptol Compiler * C++ Edition v02.11
register.cpp, compiled 1 lines
Compiling to native...
Comando o nombre de archivo no válido
Linking register...
Comando o nombre de archivo no válido
C:\Archivos de programa\scriptol
> I soght the solc.ini file should be adjusted, with the proper location of the MinGW compiler, so I did the following changes (...)
You don't need to put the path of the C++ compiler in solc.ini. Just verify that the program, is visible. Type:
bcc32     or
gcc -v     or
cl /?
If the version is displayed, the installation is complete, otherwise you have to make the program visible, add its path to the PATH variable into AUTOEXEC.BAT or equivalent:
PATH = %PATH%;c:\bcc55\bin\

Scriptol compiles into C++ but compiling C++ produces lot of error messages

I have been trying for 2 days now to install and run your Scriptol compilers. I go to Borland and download the BCC 5.5. I can compile scriptol programs to .CPP and .PHP, but I can't get any of them to run, even the simple demo one that was included with the archive. It seems like they need a whole bunch of libs, other compilers, include files, etc, etc,... to run. It will compile a CPP file, but when I put the C++ compiler to that, the whole thing blows up. BCC makes a lot of error messages, mainly because it can't find all the include files like math.h, iostream.h, those type files seems to be trying to call include files that don't exist. I have a project to write but so far I've spent 2 times the amount of time on the tools than it would have taken me to do my work!!
I usually spend more time to let external C++ programs or librairies working, than I use on making the Scriptol compiler itself.
It seems that your Borland compiler or PHP interpreter are not correctly installed.
To know if PHP is installed, just type:    PHP -v.
But for the C++ compiler it is not so easy. You have to setup two configuration files, bcc32.cfg and ilink32.cfg inside the bcc55\bin directory, with the paths of the compiler for it can locate the files to include, and win32.cfg in the bcc55 root directory.
A complete and easy to use tutorial is available from the net that can help you installing completely the compiler, look at this page

Can we use Scriptol as a converting tool?

If "we" (PHP coders) could compile PHP, that would be really good. If you help PHP coders by making a converting tool, then scriptol will become interesting. It's different if you have to recode a script or only modify it a bit after conversion.
Scriptol currently compiles Scriptol source to PHP or C++. No need to recode anything, just use it directly from scriptol. Include the file for PHP or the library or object file for C++.

C++ is case-sensitive

You say in the manual that C++ is not case sensitive, but my compiler distinguishes"var" and "Var", for example.
The C++ linker may be case sensitive or not depending the setting. I use the mode that works always, both in C++, and in PHP also that is not case-sensitive, as the sources may be used with the two portages (when available).

When will be the Scriptol for .Net version available?

The new interpreter uses its own platform. I expect it to replace .net with more powerful features.
A .net version is planned however and will be open-source.

How to pass code either to C++ or to PHP?

 To include code either in the C++ target or the PHP one, we have to use first the scriptol tags ~~ to insert target code, not processed by the scriptol compiler.
 Line starting with # are C++ directives. They are just comment in PHP. The code
below includes the "header.hpp" in C++, but the conditional statements are not compiled and the code embedded is ignored by the C++ compiler.
 The PHP interpreter ignores all lines starting by # and processes the "echo" statement, or any other statement you may have inserted at this place.

~~ 
#include "header.hpp" 
#if 0
  echo "this is PHP code\n";
#endif 
~~ 

My program doesn't work

I have a complete configuration with the Apache server, but my scriptol PHP program displays an error. Here is the code:

<sol 
  include("button.PHP");
?>
When you are used with legacy programming language you may encounter such problems. In fact, include is a keyword in Scriptol, you should write either require("button.PHP"); or include_once("button.PHP").

Can I use OpenGL and Glue with Scriptol?

If Scriptol is compiled to PHP you have to use a PHP extension. If it is compiled to C++, you can use OpenGL as with any other C++ program. When you use functions from external librairies, you have to add the library to the solc.ini configuration file, of the configuration file of you program (xxx.cfg), and the function must be declared as in the libphp.sol header file.

Can Scriptol compile my PHP scripts?

Scriptol compilers take scriptol sources and compile them either into PHP or C++, or into binary executable. What you can do is calling your PHP Scripts from Scriptol program or include them.

How to use PHP's objects from Scriptol?

I use a PHP object with 5 methods. I use a DYN for the object, the program works perfectly but lot of errors are displayed.

A dyn can only be used with builtin virtual methods. It will be unsafe if one can use methods of any PHP class without to know its declaration. You have to declare the PHP class as extern with all attributes and methods you use. It is recommended (but not mandatory) to do that with simple functions also
Ex:

extern
  class xxxx
    int attribute
    void fun(int)
      ....
    return
  /class
/extern

Then declare the PHP objet and assign null if the class is not recognized by the PHP interpreter:

xxxx myobject = null

PHP: Form's variables are not recognized

When I compile a HTML page with Scriptol embedded code, the HTML variables of the forms are not handled by the PHP generated code.
If you have installed PHP prior the 4.2 version and then installed newer version but not updated the PHP.ini file, a change is required for PHP can recognize html variables. This flag must be set on in the PHP.ini file in the Windows folder (It is Off by default since PHP 4.2):

register_globals = On

Redeclaration: every OO language should use local namespace

If you prevent users from reusing short names for block level small-scope usage variables, you run the risk of creating a slew of identifiers. One single omission of an initialization, followed by a use of a variable declared in an outer scope, in an inner scope results in violation of the block sentinel.

for(int i=0;i

Agreed this is a contrived example, however, the point is clear. In order you are expecting "i" being uninitialized and an error or warning be reported. If the declaration of "i" remained within the for block. If it did not, as it used to be in the older C++ standard, this led to side-effects of the loop counter being present in later code, which did not generated a "non-initialized" error/warning. Every OO language implement block-level local namespaces. Redeclarations are not CONFUSING as much as they are CLEARLY indicating that they user has wanted to use a name that exists outside without affecting it.

Here are two examples to show what Scriptol allows or not:
Example 1 (NOT ALLOWED)

int i
scan a
  int i = 5     //                  bad, i variable already in use 
  print i * a[]
/scan
Example 2 (ALLOWED)
int i
scan a
  int j = 5
  print j * a[]
/scan
scan b
  int j = 50   //                  good previous declaration of j no longer in use
print j * b[]
/scan

Scriptol doesn"t allow reusing an identifier for a different thing in an inner block. It allows to reuse a name in successive scopes. This suppresses a source of confusing and also is required for future control structures in the language (actions).
Take note also that variables are always initialized (in the generated target code) in Scriptol.

What runtime files are required to distribute my application?

What I think it's like this: very good language, it can build .exe, it can provide GUI features... so I can write some pretty cool applications with it (not related to websites).
But then, how I'll distribute my application? What runtime files are required?
For my kind of work is not acceptable to say to user "You need to install and configure PHP first", so this is why I'm interested to use GTK (or .NET in the future).
If your program is not linked to any library or if it linked only to static libraries, only the binary executable (.exe under Windows) have to be distributed.
Static libraries have a ".lib" extension under Windows and ".a" under Unix. They must be added to the ".cfg" configuration file of your scriptol main source.
Dynamic libraries have a ".dll" extension under Windows and ".so" under Unix. When you use a dynamic library, it belongs with a ".lib" or ".a" import library that is just an interface to the ".dll" or ".so" real code. Only the ".dll" or ".so" have to be distributed with the executable you have created. No any other file is required to distribute.

Using Visual Studio

Can Scriptol work with Visual Studio 6.0 and Visual Studio.net ?
A library is furnished for Visual C++ 7.0, and Visual C++ is a part of Visual Studio. The cl.exe compiler is common to the two tools. It is also a part of the .net framework.
Scriptol can also be integrated into the IDE for compiling Scriptol programs as with C++ Builder (version pro).

Converting PHP to C++

I want to convert my PHP program to a binary executable. The syntax of PHP is near that of C++, why using Scriptol rather than converting directly the PHP source to C++?
Learning Scriptol is a matter of hours. For a PHP program becoming executable, you have to convert the PHP library and this is a matter of years (PHP is born in 1995 and is still under development). The standard PHP library and some extensions are included into Scriptol. If you know other PHP extension compatible with C++, please, let me know...

Will Scriptol compiler remain free?

Scriptol compiler are free of charge and remain free forever. I would prefer to sell Scriptol tee-shirts instead :-)
Scriptol compilers is even partially open source now and available at Sourceforge.

How to convert the manual to PDF?

Just load the html file into Open Office 2.0 and export as PDF.

Is the Scriptol Compiler finished?

There are three levels in the Scriptol Programming Language:
- the procedural language,
- the object oriented language,
- the XML oriented language.
Plus other features that are planned or in work.
The procedural and object-oriented languages are finished.
The XML part is still in work, meanwhile it is currently usable, and is used by some programs (see at XML).