Scriptol
This page was last modified on 8 June 2016, at 13:09.
Designed by | Denis Sureau |
---|---|
Stable release | Alpha A-30 / november 2006 year |
Typing discipline | static and dynamic |
License | Mozilla 1.1, Open source, BSD license. |
Filename extensions | .sol |
Website | http://www.scriptol.net/ |
Contents
Review
Scriptol designed as a simple, safe and flexible programming language that allows you to create dynamic web pages, scripts, and executable applications. Scriptol integrates XML as a source or a downloadable file. It is a modern, object-oriented, procedural language. Scriptol is compiled to PHP Compiler Scriptol PHP. Scriptol compiler turns the script into the code of PHP or PHP-containing instructions HTML-page with embedded Scriptol. In fact, it turns the PHP virtual machine or server functions and data, for which the bytecode language is PHP. The core of the language common to PHP and C++, so you can use the same programming language for web pages and applications. Along with transparency, readability and the security provided by the syntax, Scriptol reduces design time error checking at compile time.
Description of the programming language Scriptol
The scriptol programming language was designed with seven rules in mind.
- Rule 1:Program as you think
- The syntax of the language matches the way a human thinks, and objects of the human conceptions are formalized in the simplest way. The language will have a vocal port.
- Rule 2:Safety
- The language reduces risk of errors by the programmer. It has a clear, simple, minimal, and not confusing syntax. Any cause of error is removed from the language.
- Rule 3: Common conventions
- When the 1 and 2 rules are not sufficient to define the language, this one is applied.
- The language keeps what is familiar to programmers. The main reference languages are C++, PHP, HTML.
- Rule 4: Objectivity
- No any element of the language is arbitrary choosen. Each one is determined by the seven rules and is the best choice.
- Rule 5: No limited orientation
- The language design is not oriented towards an unique trend, as objects for example. It is built also with goals, events, procedures, rules, patterns.
- The language has objects and actions. Any statement is also writable as an event. Objects are dynamic. Actions may be acquired as data.
- Rule 6: Portability
- The language will run on any OS or computer. The language is not compiled directly into native code. It is currently compiled to Php or C++, MSIL for .net.
- Rule 7: Easy learning
- For easy learning, the tutorial has two levels. The common level of the language covers the features of classical scripting. The total language will goes far beyond.
- For easy learning also, the programmer may write keywords in any human language.
The compiler is free for ISVs, a license is required only for companies. Developer Site - www.scriptol.com.
Scriptol is a modern programming language designed for quick and easy development, which affects the timing of the creation of high quality and safety projects. Scriptol is object-oriented, XML-oriented, scalable, versatile, using C ++, PHP, Java API and GTK for the GUI. Scriptol is universal, which means it is suitable for scenarios to create applications or dynamic web pages. Free interpreter and compiler Scriptol available on Windows and Unix.
Features
- Modern: it was developed in accordance of seven rules of simplicity, security and doesn't have obsolete syntax.
- Universal: suitable for applications, scripts or Web pages.
- Object-Oriented: even primitive data types, such as «Int» (eg, 123), are objects and has methods.
- Casting: the compiler can check the program and the type of variables, it is not possible with untyped scripting languages.
- Natural: types of variables are not based on computer equipment and on human understanding, or mathematical set: it is text, number, integer, real, etc ...
- Powerful and Safe: introduced new management structure
- examples:
- - Composite IF, that is both IF-operator and the switch case with any type of value.
- - while let, that protects against the endless loop.
- - For .. in array, or for .. in a..b, the easiest way to work with intervals.
- Simple: no characters as -> or ::, just a dot anyway.
- Add 1 to x: x + 1 rather than x = + 1.
- Not required memory management, since has a garbage collector.
- Compatible with C ++: you only have to link a C ++ object files or library files, and use the functions that they perform without any extension required for!
- For example, you need only to import the GTK configuration file Scriptol to use GTK-interface ...
- PHP compatible: you can program the web pages in Scriptol and your code will be converted in PHP, and all the PHP function can also be used.
- Portable: runs on any PHP or C compatible platform.
- XML-oriented: XML-document is a data structure of language and the DOM is an integrated class libraries. Using XML becomes extremely simple with Scriptol.
- Multitask: The function can return multiple values.
- indexed or associative arrays.
- You can use the API-interfaces in PHP, Java or C ++.
Why use Scriptol?
Mainly for:
- Embeding code into the page HTML. It will run on any server using PHP 4.
- Code protection through the distribution executable file.
- Easy and rapid development of scenarios, thanks to the high-level syntax.
- Building applications and Web applications: Scriptol may be integrated into tools for rapid application development and can use cross-platform GUI-libraries GTK. Scriptol does not need for the Makefile or any file of the project. Scriptol-scripts can be compiled into PHP, so it is portable. The compiler detects errors before running the program.
- Processing of documents, stored as XML, and other applications.
- the formation of XML-documents or HTML-pages from any source.
- Creating and using the database.
- It can also be used with the RAD (Rapid Application Development) tool, such as C ++ Builder or Visual Studio.
Language
Syntax
- Expressions end end of the line
- Similarly, XML-terminator structure: / if, / while etc ...
- Each operator for only a single usage, and not in the context of multiple matches, as in C.
- Scalar data types from real life: text, number, real, etc ...
- The compound expression is:
- // x + 1 is equivalent to: x = x + 1
Data Structures
Scalars, xml, class.
Control structures
- if ... else, composite if
- for ... in ... step
- while ... let
- do case ... while, do case ... until
- scan by
- break, continue, return
Note that Scriptol doesn't use switch case, so IF is a sufficiently powerful to handle various types of conditions and is actually more powerful than the switch case, because it can use various comparison operators.
Composite-If
if a
= 10: print "equal"
<10: print "less"
else
print "more"
/ if
While
While the structure has several forms, let protects against endless loop.
while x <10
print x
let x + 1
Function definition
Header similar to C, but several types may be simultaneously returned. Ends with return operator and the only key word, if nothing is returned.
int, text funcname (... arguments ...)
... statements ...
return a, b
Compare Scriptol code and PHP.
Scriptol code is intuitive and simple. Instead, PHP syntax is similar to C (programming language), Perl and UNIX shell languages (Bash), aimed at limiting the consumption of resources and not to simplify the task of programmers.
- Scriptol code
text x
input "Y/N?", x if x.lower()
= "y"
print "yes"
= "n"
print "no"
else
print "What?"
/if
- PHP-generated code
<?php
$x="";
echo "Y/N?";
$fp=fopen("php://stdin","r");
$x=rtrim(fgets($fp,65536));
fclose($fp); $_I1=strtolower($x);
if($_I1 === "y")
{
echo "yes", "\n";
}
else
{
if($_I1 === "n")
{
echo "no", "\n";
}
else
{
echo "What?", "\n";
}
}
?>
Code examples
Example № 1 «Hello World»
int main(int argsize, array arglist)
print "Hello World\n"
return 0
main($argc, $argv)
Example № 2 Fibonacci
constant int fmax = 16
int z int fib(int n)
if n <= 1
z = n
else
z = fib(n - 1) + fib(n - 2)
/if
return z for int i in 0..fmax
print "fib($i)= " , fib(i)
/for
Example № 3 Scriptol injection into HTML:
<html>
<head> </head>
<body> <?sol
print "code embedded inside html!"
?> </body>
</html>
Example № 4 Merging and printing lists
listdemo = (1,2,3) + (4,5)
subdemo = listdemo[1..3]
scan subdemo
print subdemo[]
/scan
>>> should print: 2 3 4
Example № 5 "99 Bottles of Beer"
demonstrates a simple application loop:
text bottle(int n)
if n = 0 return "no more bottles of beer"
return text(n) + " bootle" + plural(n) + " of beer" text b1 for int i in 99 -- 0 step -1
b1 = bottle(i) if i > 0
print b1, "on the wall,", b1 + ","
print "take one down, pass it around,"
print bottle(i - 1), "on the wall."
/if
/for
Присоединяйся к команде
ISSN:
Следуй за Полисом
Оставайся в курсе последних событий
License
Except as otherwise noted, the content of this page is licensed under the Creative Commons Creative Commons «Attribution-NonCommercial-NoDerivatives» 4.0 License, and code samples are licensed under the Apache 2.0 License. See Terms of Use for details.