开发者

What is Scriptol?

While searching I came across this. It looks interesting but I have absolutely no idea of what it's for. I like it because you can compile to php, a language I don't enjoy a lot that's really useful. This开发者_如何转开发 could be a way I can use php without touching it. The language is odd looking, is there anyone out there who has tried it?

Thanks


The first thing I see is that the last development change to the project was in 2007 (maybe 2008, can't tell what those side projects are), so it's out of date. Scriptol's compilers seems to take the Scriptol code you wrote and compile it in an executable file for that language.

I tried solp.exe out (the PHP compiler) with the Fibonacci example on the website. Here is the Scriptol fib.sol file:

 int fibmax = 20

int fibonacci(int n)
    int u = 0
    int v = 1
    int t
    for int i in 2 .. n
        t = u + v
        u = v
        v = t
    /for
return v

for int x in 1..fibmax echo "fib(" , x , ") ", fibonacci(x), "\n" 

Here is the fib.php file it created:

<?php
$fibmax=20;
function fibonacci($n)
{
   $u=0;
   $v=1;
   $t=0;
   for($i=2;$i<=$n;$i++)
   {
      $t=$u+$v;
      $u=$v;
      $v=$t;
   }
   return $v;
}

for($x=1;$x<=$fibmax;$x++)
{
   echo "fib(",$x,") ",fibonacci($x),"\n";
}

?>

It doesn't interface with your web server, so you must compile the scripts -- in PHP's case, instead of compiling to a .exe file, it's compiling to a .php file for your web server to execute. C++ and, had they finished it, .NET would compile to .exe's. (I did test the C++ compiler, but as I don't have a real C++ compiler on my PC, it just created fib.cpp.)

It's an interesting idea, I think: Create a generic language that has compilers to turn it into another language. I don't know of any languages that have successfully done that. I think it would be more prudent to just learn the language you are compiling to, but the idea that you could compile to multiple languages is cool. Unfortunately it looks like Scriptol hasn't been touched in years.


Scriptol is a scripting language with object-oriented, xml-oriented, extensible, universal, uses C++, PHP or Java APIs, and XUL for graphical user interface.

A Scriptol file must have the ".sol" extension,

It is not fully on the go.

Here is basic skeleton:

 int main()
      ... statements ...
   return 0

   main()             ...starting the program

Scriptol code embedded inside html:

<?sol
        ...code...
?>

Features as http://www.scriptol.net/manual.html:

Scriptol may be defined as:

object-oriented. - XML oriented (XML document may be a data-structure in source). - universal: usable for scripting, dynamic web pages, building executables. - natural: types of variables come from sciences and not from hardware: number, text, real... - XML-like styled syntax. - featuring new and very powerful control structures. - list processing on arrays and dictionaries. - PHP, C++ and Java compatible. It is a clear language thanks to: - a simple syntax. - statements ended by end of lines. - a same operator for ranges, slices, splices... - a similar syntax for all structures.

Case-sensitivy: - You cannot use any word both in lowercase and uppercase. - Keyword must be lowercase. - Identifiers are case-sensitive, but you can't redefine an identifier with different case.

Identifiers: - size up to 255 chars or less according to the target language. - lower or upper case. - start with a letter, continue with letters, underscores or digits.

Numbers: - int are signed 32 bits. (as "int" in C). - naturals are 64 bits unsigned. - reals, numbers are 64 bits floating-point. ("double" in C)

Cast: - casting by use of methods.

Garbage-collector: - automatical memory management, no need to allocate and free memory.

Object-oriented: - primitives are objects and have methods. - literals are objects and have methods. - single-inheritance. - overloading of methods (in Scriptol C++ only for now). - constructors. No destructors.

XML oriented: - XML documents may be included into Scriptol sources. XML is a data structure of the language. - instances of XML documents.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜