Full reference guide for Scriptol version 14.0.
The language is fully implemented in the Script compiler in PHP or binary.
- Inclusion in a web page is possible only with the Script compiler in PHP.
- XML can be used as a data structure in a binary compiler.
- The translator is a teaching tool and currently recognizes only part of the language (for more details see the "Change" page).
- XML is considered by the interpreter as a dynamic structure.
- XML is treated by the C++ compiler as a class named "dom" and described in the document "dom.html." In the near future, the XML format of the interpreter will be extended to both compilers.
The new Script programming language can be used with interpreters and compilers.
There is a version of Windows and Unix for each compiler.
The goal of language is to be simple, natural and therefore reduce the risk of mistakes. Scriptol means: "Scristwriter Oriented Language" or "scriptwriter's language" in French. It is a generic language designed to create dynamic web pages, scripts, and GUI applications. It can also be a scripting language for applications that process or create XML documents. The scriptol can be embedded in an HTML page and converted to the same page with PHP code ready for Net and fully portable. The language was defined by seven rules, and one page explains in detail why to use Script.
Note that the [] characters included in the statement syntax are not part of the syntax and specify an option element, except for indexes and intervals that use these characters exactly.
Command:
if [options] outgoing files
If errors are found, they are displayed and the program does not run.
Interpreter parameters:
aucune: interprète et exécute un fichier source . -v: verbeux, affiche des informations détaillés. -q: silencieux (quiet), aucun message. -f: force, ignore les erreurs et exécute le programme.
On Windows, the command:
solp [options] nomficher
If the source is already compiled, the program is interpreted, otherwise it is compiled before interpretation, if there is no error.
As long as the source has errors, the new "solp nomficher" command will compile it. If the source is an HTML page, it does not start after compilation. On Linux, the compile command:
solp options nomficher
then followed by:
php-q nomfichier.php to execute it.
Script-php compiler options:
aucune: compile un script en PHP ou le lance si déja compilé. -w compile du code inclus dans une page HTML et crée un fichier PHP. -t teste seulement, n'exécute pas. -r force l'exécution. Compile si besoin seulement. -b recompile le fichier et fichiers inclus. Le programme n'est pas lancé. -t invoque la traduction du source s'il est en français. -v affiche plus d'informations lors de la compilation. -q pas de message de compilation. -4: compile selon la syntaxe PHP 4 (les classes propres à PHP 5 ne sont pas utilisables).
These letters can be combined into one option. So -be equivalent to -b -e
To compile in C++, the program must have the following structure:
1) Declarations of global variables.
2) Definition of classes and functions.
3) Instructions. It can be embedded in the hand function () or not.
These rules do not apply for compilation in PHP or for an interpreter.
Compile command:
solc [options] file
The main file contains the hand function (). Dependencies are calculated by a compiler that knows what to compile or not.
Script-C + + Compiler Options:
-b compiler tous les fichiers objets. -c compiler tous les sources en C++ seulement. -e lier les objets en un exécutable. -r lancer l'exécutable. -t invoquer la traduction. -v informations de compilation détaillées. -q pas de messages.
A Script source is simply a text file containing commands, one per line.
Examples:
print x * 2 print x + (y / 2)
Using a text editor such as Advanced Editor, enter the following line:
print "Bonjour le monde"Save to bonjour.sol file.
When working in a command line window (MS-DOS under Windows, console under Unix), just enter:
solj bonjour ...ou solp bonjour
You can also build an executable file using the command:
solc -bre bonjourand run the created program bonjour.exe.
It is possible to work with both the editor and the console window.
The project file is not required.
In Java or PHP, a program is a source that includes other sources. Scriptol retains this structure.
The scripting source must have an include statement for each file whose content is used. The compiler calculates dependencies at several levels of inclusions and among mutual inclusions.
The Script file must have the extension "sol," and will be converted to a php extension file, or cpp and hpp, or an executable file.
This is a form of source, we will have a script or application.
Director's script
A script source is a sequence of statements and definitions of functions or classes. It can include other files containing declarations of functions, variables, classes.
The script cannot contain "main" functions (for a compiler, it itself is a "main" function).
Application
The application file contains only function, variable, and class declarations. The main source is the one that runs on the compiler command line, it must contain the "main" function and the command to call this function, as shown below:
int main() ... instructions ... return 0 main() // lancement du programme.
Scriptol can be defined as:
- object-oriented.
- XML-oriented (an XML document can be a language data structure).
- Generic - can be used to create dynamic scripts, applications, or web pages.
- natural: types come from culture, not from material (number, text, real,...).
- is the XML style for the syntax.
- have new and more powerful structures.
- list processing with tables and dictionaries.
- compatible with C, PHP, Java (can use their bookstores).
This is an understandable language due to:
- is a simple syntax.
- Statements that end with the end of a line.
- single operator for intervals, sublists.
- is a similar syntax for all structures.
Case sensitivity:
"You can't use the same word in all caps.
- Lowercase keywords.
- identifiers are case sensitive, but cannot override an identifier with a different case.
Identifiers:
- Up to 255 characters or less depending on the target language.
- Starts with a capital or lowercase letter.
- followed by letters, underscores, or numbers.
Numbers:
- integers are signed on 32 bits (for example, "int" in C).
- Natural is not signed on 64 bits.
- real, numbers ("number") in floating point on 64 bits ("double" in C).
Transform (cast):
- use of methods.
Garage collector (memory allocation):
- no need to allocate or free memory.
Object-oriented:
-The primitives are objects and have methods.
- literals are objects and have methods.
- is a simple legacy.
- congestion by methods (version C++ so far only).
- designers. No destroyers.
XML-centric:
- XML documents can be included in the Script source, XML - language data structure.
- instances of XML documents.
For Script code to be inserted into HTML, it must be included in the following tags:
<?sol ...code... ?> ou <?script langage=scriptol> ...code... </script>"Scriptol" or "scriptol" are also recognized. The keyword "script" is not required for some HTML editors. The last line of Script must end with a semicolon or a line break before the character?>
Testing HTML pages If you installed a server such as Apache or Xitami or Windows Server on your computer and configured it to recognize the php extension, your code will be processed like on the Internet, after compilation in PHP. Otherwise, it will redirect you to a test file. HTML dynamic page, and then execute PHP code:
solp -w mapage
php mapage.php > test.HTML
The statement ends with a semicolon or the end of a line. When an operator exceeds the width of a string, it is combined with the next string if it ends with a comma, an operator, or any other character that cannot complete the statement. You do not need a character in the next line to continue. Multiple statements on a single line are separated by semicolons. This can be useful if you put Script code on an HTML page and the editor joins the lines!
Comments of one line: "The comment goes from the character to the end of the line .//The C++ character is also recognized. Comments are not saved in the target language. "duplicate character makes the comment permanent in the target code. A comment in several lines starts with/* and ends with */
Script language never uses the same character for conceptually different purposes.
+ addition - sousctraction * multiplication / division ^ puissance = opérateur d'assignement. < moins que. > supérieur à. <= inférieur ou égal. >= supérieur ou égal. := assignement conditionnel. ; est un terminateur d'instruction. , sépare les éléments d'un initialiseur ou d'un tuple. : attache un corps à une en-tête, une valeur à une clé... . associe la référence d'une méthode à un objet. () regroupe des sous-expressions, les arguments d'une fonction. .. sépare les limites d'un intervalle. -- intervalle avec la limite supérieure non incluse. [] contiennent un index ou un intervalle. ? sépare condition et action dans une structure d'une seule ligne. <> opérateur de différence. & et binaire ou intersection de de tableaux. | ou binaire ou union de tableaux. << décalage à gauche. >> décalage à droite. and et logique (sur valeurs booléennes). or ou logique. not négation logique. mod modulo (C utilise %). ~~ un code à insérer directement dans le code généré.
Identifiers are the names of variables, functions, and objects. They begin with a letter followed by letters, numbers, or underscores. They cannot be distinguished by case: you cannot give the same name to two different objects, one in capital letters, the other in lowercase. Keywords are reserved words of the language, they are lowercase.
Primitives are basic objects. When they are arguments to a function, the function uses a copy of their contents, their values, and does not modify by the original, while it uses an alias for other objects.
Scriptol's primitives are as follows:
number toute sorte de nombre (jusqu'au double du C++). int un nombre arrondi à la partie entière. 32 bits. -1 vaut nil. integer identique. natural entier non signed de 64 bits. 0 vaut nil. real un nombre avec des décimales. -1 vaut nil. boolean la valeur vrai ou faux. text une chaîne de caractères. "" vaut nil. array une liste dynamique indexée d'objets. dict une liste associative formée de couples clé:valeur.There are other special types:
dyn élément générique de array ou valeur de dict. file un fichier. dir un répertoire. byte type externe de C. cstring utilisé dans les déclarations externes en langage C (traduit par char *). * désigne un pointeur de C associé à un type.
Primitives have constructors, like other objects with different arguments, which allows them to be used for type transformations.
Syntax:
int(int | number | text)
Examples:
int("123") ...représente le nombre 123 text(10) ...représente la chaîne "10".
Primitives are variables unless explicitly declared constant, with the keyword "constant."
Literal numbers write:
123 entier (int) 123n naturel (natural) 123.0 réel (real) 0.123 réel (real) 1.2e10 réel (real) 0xf8 hexadécimal true/false booléen (boolean)
A literary text is written: "untext" or "untext."
Example:
print "abc$xyz" print 'abc$xyz'in both cases, abc $ xyz is displayed.
Issue codes
For characters that cannot be placed directly in the text, a special code is used :\For example, to display the sleeve, write: "abc\" def"
\" insère un guillemet double. \' insère un guillemet simple. \n insère a retour à la ligne. \t insère une tabulation. \\ insère l'anti-slash lui-même.
Suppose you want to assign the variable a with this particular text: my "cute" machine. You can't put it in quotation marks: a = "my "beautiful" machine" The compiler won't know how to handle it! A special code is used to say that the quotes are in the text, rather than limiting it, it is\a = "ma\" jolie\" car" You can also alternate types of quotes: a =" ma'jolie" car "or a =" ma "jolie" car "
Cartoon line
You can also have text distributed over multiple lines in "~~" characters.
Example:
x = ~~ ligne 1 ligne 2 ~~
The return to the line can be a direct or entered release code.
x = "un\ndeux" ...valide x = "un deux" ... non valide x = ~~un deux~~ ... valide
If the string is enclosed in double quotes, character sequences starting with $ are variable names.
text xyz = "def" text t = "abc$xyz"
In addition, {} characters have a special meaning for the PHP interpreter, but this is not part of the Script language.
Plain quote texts preceded by $ are not interpreted at all.
text t = 'av$er\n'show: av $ er\n
The variable declaration has the form:
type nom [ = valeur ] int x text t = "demo"
As long as they are all of the same type, you can declare and initialize several variables at once.
Syntax:
type nom [= value], name [= value], etc... int x = 1, y, z = 2You can't mix multiple guys into one statement. Multiple assignments, as described below, cannot be made in one application.
int x, y = 0, 0
A "constant" modifier indicates a primitive whose value cannot change. You must assign a value when declaring.
Syntax and examples of declaring constants:
constant type nom = valeur constant int X = 1 constant boolean B = true constant text T = "texte quelconque"
Constants are usually in capital letters .
There are preset constants that are keywords of the language:
true correspond à une expression vraie. false le contraire. zero la valeur 0. nil objet non trouvé dans une séquence (Not In List). null assigné à un objet quand il n'est pas encore initialisé.
The nil keyword refers to the content of the object, and null replaces the address.
null means "has no meaning," or "declared but undefined," while nil means "not found" or "empty." The null keyword is converted to "null" in PHP and "NULL" in C++;
If an identifier is null, it cannot be used or used until it is. It can only be compared in a zero keyword.
Neil is not a real value, but rather a construction of language. Here are the meanings of the nile in different contexts...
When creating a code, C++ nil is replaced by the following values:
boolean false int -1 natural 0 real -1 text "" array {} dict {} file NULL dir NULL objet NULL dyn selon le contenu.When you assign nil to an interval in an array, nil removes that interval from the array .
When generating PHP code, nil is replaced with the following values:
retour d'une fonction: false dans une expression: false assignement: comme C++
Simple assignment syntax:
identifieur = expression
The assigned value must be of type variable:
int i = 10 int j = "343" ... incorrect
However, primitive builders allow transformations.
When an operation is performed on a variable and the result assigned to the same variable, you can simplify the statement by increasing the assignment (from one operation).
Increased assignment syntax:
identifieur opérateur expression
For example, add 10 to x and put the result in x. Instead of writing x = x + 10, we write easier: x + 10
Possible operators are + - */mod <<>> & | ^ #
Examples:
a = 1 ... donne à a la valeur 1. a + 1 ... ajoute 1 à a. x * y ... remplace le contenu de x par le résultat x * y. a * (x + 2) ... multiplie a par l'expression. a = a * (x + 2) ... comme ci-dessus. a & b ... remplace le tableau a par l'intersection des tableaux a et b.
Note that in the condition test, x + 10 simply returns the result of adding 10 to the content of x without changing x. In the enlarged instruction, this result is assigned to x.
if x + 1 : ... ici x n'est pas modifié.
A tuple of values can be assigned to a group of variables. Syntax and example:
nom [, nom]* = expression [, expression]* x, y, z = 1, x2, 8
The number of expressions on the right must match the number of expressions on the left.
Unless there is only one expression on the right, it will be assigned to each variable in the group.
Note that the function can return multiple values and will be assigned to a group of variables.
Examples:
x, y, z = 0 a, b = mafonction()
Instead of a multiple declaration, multiple assignments can be made to different types of variables.
Example:
int x text t x, t = 1000, "abc"
Multiple assignment can be used with array elements. Arrays have a dynamic size, so the target number should not correspond to the number of elements, and if the array has only one element, only the first variable will be assigned.
Example:
x, y, z = array(1, 2, 3, 4)Equivalent: x = 1, y = 2, z = 3.
x, y, z = array(1)Equivalent to: x = 1.
You can assign multiple variables at the same time using: -value or expression.
- one array
- dictation values (use the values () method).
- function call.
- is a comma-separated tuple of values or expressions.
In the case of an array or dictate, a tuple, a function that returns multiple values, variables 1-n are assigned to elements 1-n in the same order. If the number does not match, it is an error.
If the function returns only one value, the same value is assigned to all variables on the left.
The purpose of this special purpose is to assign a property or other variable that already has a default value when a new value is specified. Symbol: = conventionally assigns a variable if the value to be assigned is not nil.
The error flag is set to true if the selected expression is nil.
Example:
x := z error ? print "z est nil"The above statement is equivalent to:
if z <> nil x = z else print "z est nil" /if
Comparison operators:
= (égal) < (inférieur) > (supérieur) <= (inférieur ou égal) >= (supérieur ou égal) <> (différent)
The "in" operator checks for the presence of an element in the sequence: text in the text, an object in the array, a value in between.
if "a" in line print "dans le texte" if x in 1..10 print "dans l'intervalle"
Binary operators:
& (et) | (ou) ^ (ou exclusif) ~ (non) << (décalage à gauche) >> (décalage à droite).
Array operators are:
& (intersection) | (union) ^ (complément d'intersection).
Precedent
Unary operators have precedent over binary operators. Between operators of the same arity, the preceding values are given by parentheses.
An expression is a combination of values and operators.
Arithmetic expressions
These are arithmetic values or function calls combined with these operators:
+ - * / ^ puissance mod modulo, retourne le reste d'une division...
Example:
print 100 mod 3 ... affiche 1 le rester de 100 divisé par 3.
Relational expressions
Arithmetic expressions can be compared using a set of operators:
= égal < inférieur à > supérieur à <= inférieur ou égal >= supérieur ou égal <> différentThe comparison returns a Boolean value of true or false (true or false). This boolean value can be assigned to a boolean variable or used as a condition of the control structure, for example, "if."
Logical expressions
A Boolean expression is a combination of Boolean values or expressions (relational or Boolean) and Boolean operators.
The logical operators are:
and et or ou not non
The expression "and" returns true if both terms are true, if not.
The expression "or" returns true if one of the two terms is true, false if both are false.
Example:
boolean x = true boolean y = false if x and y print "vrai"; else print "faux" ... doit afficher faux not(x or y) ... est faux x and not y ... est vrai
Binary expressions
Binary operators are those used by most languages:
& et binaire | ou binaire ^ ou exclusif ~ négation binaire << rotation à gauche qui équivaud à multiplier par 2 >> rotation à droite qui équivaud à diviser par 2
Text expressions
Text operators:
=, <, >, <=, >= comparaison de deux textes. + concaténation de deux textes. [] indexation, slicing ou splicing (voir chapitre Text). in teste si un text fait partie d'un autre.
Example:
text t = "préfixe" print t + "suffixe" ...affichera: préfixesuffixe
Dynamic list expressions
List operators (array, dict):
= < > <= >= <> compare les valeurs de deux listes. + concatène deux listes (des doubles peuvent en résulter). - enlève d'une liste les éléments d'une autre (sauf doubles). [] indexation, slicing or splicing (voir Array et Dict). in teste si un élément est dans la liste. & intersection. | union. ^ complément d'intersection.
The intersection of the two lists returns items common to both. Merging two lists returns all their elements. Items belonging to both are saved only once. If one of the lists already has a duplicate, only the first instance is saved.
Some programming languages set precedent rules, so when parentheses are omitted, it is known which term concerns each operator. Although the precedent was built in the Script parser, message errors will be sent if parentheses are omitted, as they are necessary for readability.
The only case where history is allowed without parentheses is for the unary operators: not, ~ The unary operator always applies to the following term, so to apply it to an expression, you need to place it in parentheses. Example:
if not a and b if not (a and b)The operator is not associated with the object "a" in the first, in the second - with the negation of the expression.
In compound assignments (see below), the first statement refers to the variable to be assigned with the expression to the right of it .
The function is defined using an interface indicating how to call it, a set of instructors, and ends with the keyword "return."
Expected return type and argument type. Use "void" if the function returns nothing.
Syntax:
type [,type]* nom ( argument [, argument]* ) [:] ... instructions ... return [expression [, expression]*]
Example:
int multiply(int x, int y) int z z = x * y return z
This can be written more simply:
int multiply(int x, int y) return x * y
The body of the function is a list of statements that include "return" statements as needed.
The end of the definition is a return with zero, one, or more values.
return return x return x, y, 5
If a function returns multiple values, it must have multiple return types and a return statement to multiple parameters (in the same order as return types).
Example:
text, int, int coordonnees(int num) int x = matable[num].x int y = matable[num].y return "coordonnées=", x, y
Function call
A function call can assign zero, one, or more variables.
mafonc() a = mafonc() a,b,c = mafonc()
When a function has objects as arguments, the argument names are aliases of the objects, and any changes to the function are actually made on the original objects. By default, primitives are copies and alias objects. You can change it using the modifier: "pseudonym": the name of the primitive becomes the pseudonym of the original.
void mafonc(number x) x + 1 print x return void foncalias(alias number x) x + 1 print x return number y = 5 mafonc(y) print y ... doit afficher 6 puis 5 foncalias(y) print y ... doit afficher 6 puis 6.
By specifying a default value, you can specify an option for calling the function. Full interface syntax:
type [,type]* nom(type nom [= expression] [, type nom [= expression]]* )
Example:
int increment(int x, int y = 1) x + y return x print increment(10, 5) ...affichera: 15 print increment(10) ...affichera: 11A default value of 1 was used to replace the missing parameter.
If a function interface has several argments with a default value, you cannot skip one of them when calling without skipping all of the following. Arguments cannot be recognized by their type.
If you want to write a function with a variable number and parameter types, then you need to use an array or dictionary instead.
Example:
void param(dict parlist) taille = parlist["taille"] nom = parlist["nom"] valeur = parlist["valeur"] return
In this example, the variables "size," "name," "value" are global, and it is assigned to the dictation content in the arguments.
For this example to be perfect in fact, you need to use conditional agendas through a test. Or using the conditional assignment symbol: =
x: = y
x is set to y only if y is not nil.
A scope is the level of visibility of declared objects. The function opens a new scope for all variables declared inside. If the function is in the global scope, the function displays all global variables compiled before the function.
Cannot re-write a variable with the same name as a global variable to a function.
If the function is a class method, the function displays all variables declared in the class before the function.
Objects declared in the function are visible in control structures within the function.
The PHP interpreter may not display error or warning messages before calling the @ symbol function.
The character is ignored by the binary compiler.
@mafonction(x, y)
It is useful to be able to switch parameters to the program from the command line.
Script (such as PHP) uses the PHP variable $ argv." To simulate how C++ moves from parameters to the program, create a "hand" function and call it with $ argv in the argument (and $ argc if necessary):
int main(int argnum, array arglist) print argnum, "arguments" scan arglist print arglist[] /scan return 0 main($argv, $argc) // argv and argc sont des variables PHP externes.
The main function either has no arguments or has two:
int main() int main(int, array)
Echo
Displays an expression or a comma-separated list of expressions with no spaces between them and no return to the end string (as in printing).
Syntax: Echo Expression [, expression]
Example:
x = 5 y = 20 z = 1 echo "values", x, y / 2 echo zOn the screen it will look like this:
Example:
echo "demo", 5 echo "next"displaying: demo5next
Print
A more complex display is obtained using the print statement. The expressions are separated and we go to the line at the end of the statement.
Syntax: Printed Expression [, expression]
Example:
print "demo", 5displaying: demo 5
A simple print statement without an expression sends a return to the string.
Example:
Use the input command to enter text from the keyboard.
Text can be displayed before text is entered.
Example:
text name input name print nameExample:
input "who are you? ", name
The input command must be preceded by a variable, which must be any type of text or number.
Control structures:
if if else /if. if une instruction. if composite. for for /for. for une instruction. - options: in intervalle, in séquence. scan by fonction. scan une instruction. scan /scan. while while let. while une instruction. while forever do while do until. do /do condition. do case / else / always /do. enum enum simple. enum dictionnaire. error error /error. error une instruction.
The scriptol has a different syntax for instruction or multiline control structures.
The control structure of one instruction has the form :
mot-clé-de-structure expression let instruction ou mot-clé-de-structure expression ? instruction ou mot-clé-de-structure expression instruction commençant par un mot-clé.There is no end marker other than the end of the line. The statement is a base statement and cannot be a different construct.
The multiline control structure has the form:
nom-structure expression [:] ... instructions ... /nom-structureA point-to-point parameter is optional (unless the statement is on the same line).
Example with separators:
if a = b : print t ; /if
Conditional control structure from row to shape:
if expression-booléene let instruction [else instruction] ou: if condition let instruction ; else instructionIt says: if true state? then action; otherwise actions
The scriptol uses either the keyword "let" or "?" when the action is a unique instruction or ":," or a return to the string when it is a block of instructions.
Examples:
if a = 5 ? break if a < 5 ? print "moins que" else print "plus que ou égal" if a = 1 ? print "un"; else print "plusieurs"
Cartoon line
Syntax:
if condition-booléenne [:] ... instruction ... else ...optionnel ... instructions ... /ifN.B.: A point-to-point character is optional after a condition, like a semicolon after a statement, but it is required when joining strings.
Example:
if (x + y) > 8 print "> 8" print x else print "<= 8" /if if (x + y) > 8 : print "> 8" ; print x ; else print "<= 8"; /if
The C++ or Java design switch does not exist in Script because it is too limited and useless (in Script). It is reproduced by a more powerful variant of the if construction, which can test any type of variable and multiple genres of comparisons.
Syntax:
if expression non-booléenne [:] operateur expression : instructions operateur expression : instructions ... else ... instructions ... /if
A non-Boolean expression is a variable, literal, or any expression that does not return a Boolean value of true or false.
The keyword "break" does not fit at the end of the group, as in C. Breaking will cause the control structure containing the if construct to exit.
Valid operators are =, <,>, <=,> =,! =, <>, in, else.
"else" here is equivalent to "default" of switch C.
Example:
if a = 1: print 1 = 2: print 2 > 2: print ">2" else print "<1" /if if x in array(1,2,3): print "premier" in array(4,5,6): print "second" in array(7,8) : print "troisième" else print "autre" /if
Citter Control Structure conducts either an integer interval or an array and assigns each element to a variable in turn.
Syntax for interval:
for variable in début..fin [step s] [:] ... instructions ... /for
The start, end, and step are identifiers or literals.
The step is optional and the default value is 1.
A thin boundary is included in the interval if the interval symbol is.. "" and not if the symbol is "-."
The end may be less than the beginning if a "step" is present and contains a negative step.
A container variable can be declared in the header. In this case, it is local to the controlling structure.
Syntax for list:
for variable in expression-tableau [:] ... instructions ... /for
In this case, the content of the expression is viewed and each element is assigned to a variable. This expression must be a table or combination that creates a table.
Examples:
for i in 1..10 print i /for for w in montableau print w /for for w in arr1 + (arr2 & arr3[0..5]) print w /for
For instruction
Short statement syntax:
for variable in liste let instruction-basiqueExamples:
for w in maliste let print w for x in 10..1 step -1 let print w + 10
Allows you to scan tables and apply a function to each element.
Syntax:
scan a by f ou scan a [, b, c ... ] ... statements ... /scan- a, etc. are arrays (array, dict).
The scan by format is applied to a single array for compatibility with PHP 5, you can use multiple arrays with the format in tags, and possibly place a function call in a block. Scan applies the f function to each element of the array specified as a parameter .
When the last table entry is reached, processing ends.
For an element to be modified by a function, the "alias" modifier must precede the argument type in the declaration of the function being used. Scanning requires a custom function, not a class method.
In marked form, each array element is processed by instructions inside the body of the structure. The current item is accessed by an empty index [].
Statement syntax is also allowed:
scan a let instruction
Examples:
array a = {1,2,3,4} void fun(number x) : print x * x; return scan a by fn scan a : print a[] * a[]; /scan
Both examples have the same result.
You can change the table to [] =...
Examples:
scan a let a[] = 0 scan a a[] * a[] print a[] /scan
Example with multiple tables:
void mulfon(dyn a, dyn b) print a * b; return scan a, b by mulfon ou scan a, b let print a[] * b[]
Here is an example of creating and viewing a two-dimensional table:
array a = ( ("a", "b", "c"),("x", "y", "z"), (1, 2, 3))This table contains three dyn (dynamic variables), each containing one table.
scan a array x= a[] scan x print x[] /scan /scan
The while control structure is a conditional loop.
The syntax of one command is:
while expression let instruction
Standard syntax:
while expression [:] ... instructions ... /while
Example:
int x = 10 while x < 20 print x x + 1 /while
The "break" instruction comes out of the loop.
A "continuous" statement ignores all of the following and starts a new loop .
This syntax is recommended to avoid the risk of endless loops.
The statement that changes the value of the tested expression as an iteration condition is moved after the/while marker with the "let" command.
Example:
while x < 10 if (x mod 2) = 0 continue print x /while let x + 1
A continuous statement skips the let statement.
There is no equivalent in C or PHP, as the continuous statement skips the following code, including the x increment, which leads to an infinite loop.
Simplified and repeated syntax:
while condition ...instructions... let incrementationExample instruction:
while x < 10 let x + 1 while x < 10 : print x; let x + 1
The condition of the while loop can be the keyword "forever," and you enter an endless loop from which you exit through a break .
The block of instructions between do/do markers is the new visibility space, and the included instructions are subtracted depending on the possible condition.
General syntax:
do ... instructions ... /do [ condition ]and/do condition can be simplified to "until."
The syntax for do until is:
do .. instructions ... until expression do print x x + 1 until x = 10
This is a powerful pattern-matching design. It contains one or more groups followed by an optional "else" and an optional "always." Only one group of check boxes is executed, the first of which meets the requirements. Always is always true, else when no condition is true.
Field syntax:
do case condition : instructions [ case condition : instructions ] [ else instructions ] [ always instructions ] /do [while expression]
-The condition is followed by a two-pointer or the end of a line. "else" and "always" are also for homogenization, but not necessarily. -Performs only one check box or not if the expression is not recognized.
- else group equivalent to "default" with.
- the always group is always executed after another case. - the end tag is/do or/do forever or/do while.
-The forever or while command makes the structure automatic. In order to get out, you may need a break.
- You should not put a break at the end of the group, as in C. This will leave the structure, not the group.
Examples:
do case nom = "pussycat": print "c'est un chat" case nom = "flipper": print "c'est un dauphin" case nom = "mobby dick": print "c'est une baleine" else print "un autre animal" /do int state = ON do case state = ON: counter + 1 case state = OFF: break always state = getState() ` une fonction quelconque /do while forever
Automation that reads its state from one and continues to rotate until the OFF state created by the called function is detected.
The end marker do can be supplemented with a condition, while or forever.
The instruction block will be executed at least once and as long as the condition is correct.
Syntax:
do ... instructions ... /do while expression do print x x + 1 /do while x < 3
Options - before .../before... instruction block with or without flags. - do .../do while forever... endless loop. - before .../before forever... simplified infinite loop. an infinite loop requires a "break" to stop execution.
The command to exit the loop.
An example of using the keyword "forever," which intentionally creates an infinite loop.
int x = 0 while forever print x if x > 100 break /if x + 1 /whileWhen x reaches 100, the break statement causes the program to jump beyond/while, to instantiate after the while structure.
Continuous
This second command allows you to skip all instructions from the current position to the end of the structure, so start a new cycle .
int x = -1 while x < 20 x + 1 if (x mod 2) = 0 continue print x /whileIn this example, only even values of x are displayed, because when an odd value is detected, the condition x mod 2 is checked and a continuous command is executed.
Enum allows you to sequentially assign values to identifiers, and in Script it allows you to assign non-integer values - real or text.
By default, an integer is assigned from zero and incremented for each identifier in the list.
A double point is used to assign a specific value to an identifier, and an equal sign is used to restart that value.
Syntax:
enum identifieur [ : value | = value ] [ identifieur ...]* /enum
enum: Z, UN, DEUX, TROIS /enumThis assigns 0 Z, 1 UNE, and so on. This is equivalent to:
constant int Z = 0 constant int UN = 1 etc... ou: enum: Z:0, UN:1, DEUX:2 /enum
A more complex example of assigning heterogeneous values and starting a sequence:
enum Z : "a0", ... assigne a0 UN : "a1", ... assigne a1 TROIS, ... assigne 0 QUATRE : 3.15, ... assigne 3.15 CINQ = 5, ... assigne 5 et redémarre la séquence SIX ... assigne 6 /enum
An example of a simplified syntax in a statement:
enum ZERO, UN, DEUX, TROIS
Text or table hint syntax is [hint]. Index must be a simple expression with no nested brackets. A simple expression is a literal number, identifier, function call, or arithmetic expression and must be evaluated as an integer.
Interval syntax:
début..finTo specify the list, enclosed in square brackets:
nom-liste[début..fin]
The beginning and end are whole expressions. The last element is included in the interval if the operator is not used: "-"
a[0 -- 100] équivaud à [0..99] a[x -- y] équivaud à a[x..y-1]
Interval analysis:
0..10 x..y x * 2 / 4 .. y + 10
You can use the interval to:
- check if the value is in the range: if x in 10.. 100
- scan interval: for x to 1.. 100
- extract part of the list: array b = a [x.. y]
- change part of the list to [x.. y] = other list
When indexing a list, the lower or upper limit of the interval may be omitted.
Il y a trois moyens pour découper une liste: array a = array(x0, x1, x2, x3, x4, x5, x6, x7, x8) array b = a[..2] array c = a[3..5] array d = a[6..] On obtient trois tableaux avec ces contenus: b: (x0, x1, x2) c: (x3, x4, x5) d: (x6, x7, x8) On les affiche: b.display() c.display() d.display() On doit voir: array ( [0] => x0 [1] => x1 [2] => x2 ) et ainsi de suite...
To replace the interval with another list, just assign:
a [3 .. 5] = array ("a," "b," "c")
The content becomes:
(x0, x1, x2, «a», «b», «c», x6, x7, x8)
With the same syntax, the sublisting is replaced by a list or element:
a [3 .. 5] = «xyz»
Original tea list become:
(x0, x1, x2, «xyz», x6, x7, x8)
To delete a sublist, declare nil, "not in the list" (not in the list):
a [3 .. 5] = nil
Removed sublist 3.. 5, which is (x3, x4, x5), we get:
(x0, x1, x2, x6, x7, x8)
You can check whether the value belongs to a sublist.
Example:
array a = array("un, "deux", "trois") if "deux" in a[2..5] print "dedans"
The text is the main object with methods and contains a string.
When the text is an argument to a function, the function uses a copy rather than an alias in the source text.
Index can be negative in range, not indexing.
Syntax:
text s crée un texte. s = "str" initialise. s = s[i] prend un caractère. s[i] = s2 remplace un caractère, s2 a un seul caractère. s = s[i..j] prend une sous-chaîne, de i jusqu'à j inclus. s[i..j] = s remplace une sous-chaîne. s[i..j] = "" supprime une sous-chaîne.
Literate text is a string of characters stained with single or double quotes.
The + symbol can be used with texts, and it is a concatenation of two lines.
Example:
text b = "préfixe" text a = b + "suffixe"Content a will be: "prefix."
Return Method Fonction Méthodes de text ---------------------------------------------------------------------------- Retour Méthode Fonction ---------------------------------------------------------------------------- text capitalize() met la première lettre en majuscule. int compare(text) compare lexicographiquement deux textes (ignore maj). retourne -1, 0, 1. text dup(int) retourne un texte dupliqué n fois. Ex: "*".dup(10). void fill(text, int) remplit avec le texte en argument dupliqué n fois. int find(text s2) retourne la position du texte s2 dans le texte, retourne "nil" si non trouvé. (tester si = nil car <> nil ne va pas en PHP) int identical(text) compare, différencie maj/min. Retourne -1, 0, 1 void insert(int, text) insère in text à la position donnée. boolean isNumber() retourne true si le texte contient un nombre. int len() retourne la longueur. int length() retourne la longueur. text lower() met en minuscules. text ltrim() supprime blancs et codes de contrôle au début. text replace(ft, rt) remplace chaque occurence de ft par rt. void reserve(int) alloue la taille donnée pour utiliser comme buffer. array split(sep) découpe le texte en éléments séparés par sep. int toInt() convertit en entier. natural toNatural() convertit en naturel. real toReal() convertit en réel. text toText() cast une chaîne littérale en text (pour C++). text trim() supprime blancs et codes de contrôle en début et fin. text rtrim() supprime blancs et codes de contrôle en fin. text upper() met en majuscules. text wrap(int size) mots non coupés. ----------------------------------------------------------------------------
Declared with type: dyn.
Dynamic variables have methods of all other types of variables, but not methods of declared classes (see exter). When a variable is assigned dyn, a cast is required to assign dyn content to a typical variable.
Din methods
- conversion methods: toBoolean, toInt, toNatural, toText, toNumber, toArray, toDict, toFile, toObject. - test methods of type: isBoolean, isInt, isInteger, isReal, isNumber, isNatural, isText, isArray, isDict, isFile, isObject.
-The arrayType method (returns the type of the typed array).
A sequence is a static (text) or dynamic (array or dict) list.
Lists and sequences have the same operators except # and |. Operations in lists:
[] : indice, lecture ou modification de sous-liste. + : fusion de deux séquences. Ou ajoute un élément à une liste. - : supprime une séquence d'une autre, ou un élément d'une liste. = : comparaison de deux séquences. in : teste si un objet est dans une séquence. & : intersection de deux listes (donne les éléments communs). | : union sans doublons de deux listes.
There are two types of dynamic lists in Script:
array: (tableau) indicé par des nombres entiers. dict: (dictionnaire) les clés sont des textes.
An array is an indexed, dynamic list of objects or literals.
An empty table is represented by {}.
A literate table is a comma-separated list of expressions inserted between {}.
A variable can be an array element.
The constructor begins with the keyword "array."
To show the contents of table a, we enter a.display () and get something from the shape:
array( 0 : un 1 : deux 2 : trois )
The array constructor has the form: array (value, value, etc.)
The number of arguments varies from 0 to n. Empty initializer written: array ()
A literary picture is being written: {... Values...} You can define an array by assigning a constructor, a literal array, or a unique value .
Syntax:
array a crée un tableau. array a = array() crée un tableau vide. array a = {} crée un tableau vide. array a = array(x, y, ...) crée et initialise un tableau. array a = {x, y, ...} crée et initialise un tableau. array a = { 8, 9 } assigne un tableau litéral. array a = array(8) utilise le constructeur. array a = 3 crée un tableau d'un élement.
Array elements can be any expression except the logical expression * * *. If you put the true value in a PHP array, each time you use the "in" operator, the true value will be returned with any value you search for.
A table can be declared without assigning content and subsequently populated:
array a a.push("un") a.push("deux") a.push("trois")
Elements are found by their position in the table.
Examples:
a[1] = "a" a[2] = "b" scan a print a[] ... doit afficher: a b
Array elements are available as an integer.
Syntax:
a[n] lit l'élément ayant le numéro n. a[n] = x remplace l'élément à la position n. a[n] = nil efface un élément. a = {} efface le tableau entier. a.[n].upper() appel d'une méthode sur l'élément n du tableau.
An empty index indicates the current item:
a[] élément à la position courante.
An index can be any expression that evaluates to an integer. Expression cannot contain an array element.
a[10 + x / 2] valide. a[10 + b[5]] n'est pas valide.
Because an array can contain any type of object, or even other arrays, a dynamic variable is required to read an item, unless it is associated with a type of item being read.
array a = { x, "two", 3 } dyn x = a[1] utilisation de dyn pour lire l'élément de type inconnu. text t = a[2] int i = a[3]
When you add an item outside the limit, it is placed last in the table.
When you assign an item with the following statement, the content changes depending on the target language:
a[1000] = "x" En PHP: array( 0 : un 1 : deux 2 : le dernier 1000: x ) En C++: array( 0 : un 1 : deux 2 : le dernier 3: x )
In PHP, index 1000 is only temporary and will change as soon as the statement changes the table.
The statement in the form a [n] = x is used to change the value of this index, you should not assign a table in a way that is suitable only for dictionaries (dict), as shown below.
Table contents can be viewed by the iterator.
The first element is indicated by the begin () method, or the last with end (), the running element is obtained by an empty figure index [].
begin() pointe sur le premier élement et retourne sa valeur. end() pointe sur le dernier élement et retourne sa valeur. inc() déplace sur l'élément suivant. Retourne la valeur pointée avant, ou nil au-dela du dernier élément. dec() déplace sur l'élément précédant. Retourne la valeur ou nil. index() retourne l'index de l'élément pointé. value() retourne la valeur de l'élément pointé. [] indice de l'élément courant. nil signifie "not in liste" et est retourné par différentes fonctions quand aucune valeur ne peut être retournée.
Example of using table a:
a.begin() ` déplace sur le premier élément while a[] <> nil ` teste si la fin de liste est atteinte print a[] ` affiche l'élément actuellement pointé a.inc() ` déplace sur l'élément suivant /while
In descending order:
a.end() while a[] <> nil print a[] a.dec() /while
After creating a table, you can apply various list or stack functions...
a.push("item") ...ajoute un élément à la fin de la liste a.unshift("item") ...ajoute un élément au début de la liste a.pop() ...lit et enlève le dernier élement a.shift() ...lit et enlève le premier élement
Thus, you can read and delete table elements using the following statements:
print a.shift ()
The interval is limited to the position interval .
a[pos..fin] la rangée entre "pos" et "fin" inclus. a[..fin] du début jusqu'à la position "fin". a[pos..] de la position "pos" à la fin du tableau. a[..] prend le tableau entier (peu utile). a[pos..fin] = nil supprime une rangée d'éléments. a[pos..fin] = dyn remplace une rangée par un tableau/élément (id).
You can add or remove an element or group of elements with the + and - operators.
Example:
array a = array("un", "deux") array b b = a + array("trois", "quatre") maintenant le contenu de b est de quatre éléments. a = b - array("un", "quatre") maintenant le contenu de a est: ("deux", "trois").
Only arithmetic operators + and - with the membership operator "in" can be used on arrays.
Operator "in"
This statement can be used to check whether a value is in the list (array, dictation or even text), as well as to view the content.
Syntax and examples:
if variable in array for variable in array if x in a : print "dedans"; /if if x in array(1,2,3) : print "dedans"; /if for x in a print x for t in array("un", "deux", "trois") print t
Binary dynamic list operators
In dynamic lists (array or dict), you can use binary intersection and union operators. The intersection of two lists returns only those items that are both included in both lists. Combining two lists is a new list consisting of elements of the first, plus those from the second minus those who are already in the first.
& intersection | union ^ complément d'intersection a = array(1, 2, 3, 4) & array(3, 4, 5, 6) fait que a contient (3, 4).. a = array(1, 2, 3, 4) | array(3, 4, 5, 6) fait que a contient (1, 2, 3, 4, 5, 6).
The number of measurements is not limited. For a two-dimensional table, the syntax for...
- access to element: x = nomarray [i] [j]
- change element: nomarray [i] [j] = x
To create an element, the syntax is:
nomarray[i] = array() nomarray[i][j] = x ou nomarray[i] = array(x)You cannot create an element directly in a subordinate array that does not exist. The indices i and j assume that i and j elements already exist.
We need to know how whole array keys in PHP change depending on the operations that can be performed. This is important for understanding associative tables and avoiding many errors.
Content is displayed after each operation.
array a = {} array ( ) a.push("un") array ( [0]=> un ) a + array("deux", "trois", "quatre") array ( [0]=> un [1]=> deux [2]=> trois [3]=> quatre ) a.shift() ... le premier élément est supprimé et les clés sont renumérotées. array ( [0]=> deux [1]=> trois [2]=> quatre ) a[1000] = "mille" array ( [0]=> deux [1]=> trois [2]=> quatre [1000]=> mille ) a.unshift("x") ... toutes les clés sont renumérotées, même la clé 1000. array ( [0]=> x [1]=> deux [2]=> trois [3]=> quatre [4]=> mille ) Créons deux nouveaux tableaux: array a = array("un","deux") array b = array() b[1000] = "mille" a + b Les clés sont renumérotées. array ( [0]=> un [1]=> deux [2]=> mille )
If you replace a + b with a.push ("thousand"), the result is the same.
Dictation is a smoke list of key and valuable couples. Keys are always texts. Values can be any object.
The key and value can be variable. Key pair and value format: key: value.
(PHP equivalent: key => value). An empty dictation is represented as {}. A literal dictation is a list of pairs separated by a comma and bent between {} t.
On the contrary, the dictation is filled with agendas:
d[k] = "b" d["un"] = "element 1"
Array and dict have the same methods, but some are more useful with one type or another.
You can create a dictation from a literal or constructor.
Syntax:
dict d crée un dict. dict d = {x:v, y:w,...} crée et initialise un dict. dict d = dict(x:v, y:w,...) c crée et initialise un dict.
Values can be any object type.
The key can be a variable and the value can be an expression.
Example:
text k = "a" text v = "b" dict d = dict(k : v) dict d = dict(k : v + "x".dup(4) + 20.toText())
This example writes in dict d "ball 20" with key "a."
Values in the dictation are available with a text key.
Syntax:
d["clé"] prend le premier élément avec la clé "clé". d[clé] = valeur remplace une valeur ou ajoute un couple clé-valeur si la clé n'est pas déja dans le dict. d[clé] = nil supprime un élément. d = {} efface le dict. Exemple: dict d d["program"] = "ce que l'on veut accélerer" print d["program"] affiche le texte ci-dessus.
The usual way to use the dictionary is with keys or iterators. In some cases, direct access to a range of values may be useful.
- When adding an element or other dictation to the dictation, using intervals, push, unshift, PHP generates a new key for this element. The new key is a number.
- If you replace the interval with another dictation, some elements may be lost. This also happens when merging.
- Keys of the dictation replacing the interval are not saved.
Display views:
He must present all the keys and values in dictation.
dict d = {"a":"alia", "b":"beatrix", "c":"claudia"} création du dict d.display() affichage for k,v in d : print k, v; /for affichage avec une boucle for number i = 0 d.begin() while i < d.size() affichage avec un itérateur print i,"i", d.clé(), d[] d.inc() /while let i + 1
Example: read the last pair:
v,k = d.end(), d.key()The order is important because d.end () moves the pointer to the end.
Return Name Actiondyn begin() pointe sur le premier élément. dyn dec() retourne un élément et décrémente le pointeur. void display() affiche le tableau. dyn end() pointe sur le dernier élément. boolean empty() return true si le tableau est vide. int find(dyn) recherche un élément, retourne l'index ou nil. void flip() les valeurs deviennent clés et inversement. dyn inc() retourne un élément et incrémente le pointeur. int index() retourne l'index de l'élément pointé. void insert(int, dyn) insère un élément à un index entier (pas un text). text join(text sep) convertit en text avec le séparateur donné. text key() retourne la clé de l'élément pointé. void kSort() réordonne les index en préservant les associations. boolean load(text nom) charge un fichier dans un tableau ("file" de PHP). dyn min() retourne la valeur la plus faible. dyn max() retourne la plus forte valeur. void pack() rend les éléments du tableau consécutifs. dyn pop() lit et supprime le dernier élément. dyn pop(int) lit et supprime l'élément à la position donnée. void push(val) ajoute un élément à la fin. dyn rand() retourne un élément à une position aléatoire. array reverse() retourne la liste en ordre inversé. dyn shift() lit et supprime le premier élément. int size() retourne le nombre d'éléments. void sort() trie les valeurs en ordre ascendant. void store(text nom) sauve le tableau dans un fichier. number sum() calcule la somme des éléments. array unique() retourne le tableau sans valeur en double, la première est gardée. void unshift(dyn) insère un élément en première position. dyn value() retourne la valeur pointée. k,v = d.key(), d.value() lit le couple clé:valeur
The typed table contains a unique object type. This is much more efficient than a general table because it is indexed rather than associative, and contains directly 32 or 64-bit objects or pointers rather than dynamic objects (dyn).
An array of integers is 100 times faster than the standard array for binary executables, but there is no difference in PHP.
Typed tables are also dynamic, and size is not predefined or constrained.
The conspirator of a typical picture has the form:
type(...éléments...) Exemple: int(1, 2, 3)Number of elements from 0 to n.
If there is one element, there is no difference between a typical array constructor and a scalar constructor:
int(1) text("text")This is not a problem when assigning, since a single-element array can be created from a scalar array, but there is ambiguity in the expression.
type{...éléments...}Hugs matter "picture."
The syntax for declaring an array of integers is:
int[] i = int(x, y, ....)Once declared, it is used as a mixed array, but only integers can be added to it.
Examples:
int[] x = int(5) int[] x = int(1,2) int[] x = y + int{5}
The statement reads:
text[] t = text(a, b, "demo", ...)The rules are the same as for integers .
Applications:
real[] r = real(1.0, 2.0, etc...) natural[] n = natural(1, 2, etc...) number[] n = number(1, 2.0, ...)
The statement reads:
class uneclasse ... /class uneclasse objet1 ... instance uneclasse objet2 ... instance objet[] = objet(objet1, objet2, ...) ... tableau d'objets
You can assign a typed table to a mixed table:
Example:
int[] i = int(...) array a = iBut you can only create a mixed picture with a typical constructor:
Examples:
{1,2,3} ... c'est un tableau mixte, avec des éléments entiers int[] i = {1,2,3} ... NON VALIDE, il faut plutôt écrire: int[] i = int{1,2,3} ... valide.
Examples:
array a = int(1,2) ... NON valide array a = array(int(1,2)) ... NON valide
You can assign a typical dean pattern.
int[] i = int(1,2) dyn d = dyn(i)
There are two methods to use this dyn:
arrayType () returns the array type contained in dyn.
toList (int = 0) returns a typical content array.
The parameter is a type and is required when dyn contains a mixed array that you want to convert to a typed array.
Recognized types:
$TYPE_INT tableau d'entiers $TYPE_TEXT $TYPE_REAL $TYPE_NATURAL $TYPE_NUMBER $TYPE_OBJECT
Example:
d = dyn(int(1,2)) if d.arrayType() = $TYPE_INT: int[] i = d.toList() = $TYPE_TEXT: text[] t = d.toList() /if
For PHP compatibility, adding an element to an array larger than the current size has the same effect as adding this element, regardless of the specified index.
Exempli gratia:
int[] i = nil i[10] = 10 équivaut à: i.push(10)
Adding values is the correct way to fill the table.
If we really want to put an element in a given position, we must fill the table with zero values...
for int k in 0 .. 10 let i.push(0)You can now place the element in position 10.
- The method cannot be applied directly to the specified element.
i[10].toText() .. non valide int x = i[10] x.toText() .. valide
- Cannot directly compare element and string. Exempli gratia:
text[] t = text("un", "deux") if t[0] = "one" .. non valide text t2 = t[0] if t2 = "one" .. valide
- Using PHP 4.3, insert the object into the table, so the values will be inserted, not the table itself! I believe that these tdonc bugs cannot be inserted directly, but you can insert an object table.
- The PHP function "array_diff" does not work when the array contains objects, so it is impossible to subtract such arrays.
A file is a virtual object for processing local or remote files.
For a complete explanation of the file system, see "fopen" in the C or PHP manual.
A queue object is created by declaring an instance of a queue type. The file on disk is created with the open command. It provides access to the file in various modes, depending on the second parameter of the method.
The error control structure allows you to check whether the file was opened correctly or not.
Syntax for creating or opening a file:
file nomfic declare un file. nomfic.open(path, mode) ouvre un fichier selon un chemin et un mode. Types de chemins: http://path fichier distant http. ftp://path fichier distant ftp. path fichier local. Modes: "r" lecture seulement, à partir du début. "w" écriture seulement à partir du début. "r+" lecture ou écriture au début du fichier. "a" ajout en fin de fichier en écriture seule. "a+" lecture à la position courante, ou écriture à la fin.
File methods:
return méthode action int eof() retourne true quand la fin de fichier est atteinte. int open(text, text) crée ou ouvre un fichier. Positionne le drapeau "error". int close() ferme le fichier. text read(int) lit un bloc selon la taille en argument, retourne un text. text readLine() lit et retourne la ligne suivante dans un fichier de texte. int seek(int) va à la position donnée en argument, retourne 1 si ok. int size() retourne la taille du fichier. int time() retourne la date de dernière modification. int write(text) écrit le texte donné en argument, retourne la taille écrite. void writeLine(text) écrit le texte en argument.
Examples:
file nomfic crée un objet file. nomfic.open("monfichier", "r") ouvre un fichier physique. nomfic.close() ferme le file. boolean b = nomfic.eof() assigne vrai à b si la fin de fichier est atteint. nomfic.seek(250) lecture ou écriture en sautant 250 octets.
Deleted files are not currently managed by Scripting C and the interpreter.
The file can be read by lines or by binary blocks.
In the first case, the readLine () method is used, otherwise the read method is used with the block size in the parameter.
The line terminator in the file is included and can be removed by the rTrim () method.
Examples:
text t = nomfic.readLine() lecture d'une ligne de texte. text t = nomfic.read(1000) lecture de 1000 octets.
The write method places the contents of the text variable in a file. After opening the file in "w" or "a" mode and saving either from scratch or at the end of the current content, each new write call adds new text to the end.
A simple example:
text nomfic = "monfic" ` nom du fichier file sortie ` nom de l'objet virtuel sortie.open(nomfic, "w") ` ouvert en écriture error? die("impossible d'ouvrir " + nomfic) for text ligne in maliste ` un tableau quelconque sortie.write(ligne) ` enregistrer un élément /for sortie.close() ` fermer le fichier
The dir type has a constructor and get () and is used to use the built-in directory management functions.
The constructor is used to create or display a dir.
void dir(text) constructeur. L'argument est un chemin. array get() retourne le contenu du répertoire dans un tableau.
print dir("c:/jeux") ou dir x = dir("sousdir") print x ou array a = x.get() a.display()
The directory separator is "/" for all systems.
Directory management functions:
dir opendir(text) ouvre un répertoire, retourne un dir. text readdir(dir) lit l'entrée suivante et retourne le nom. void closedir(dir) ferme le répertoire. void rewinddir(dir) revient à la première entrée. boolean is_dir(text) retourne vrai si l'entrée est un répertoire. boolean is_file(text) retourne vrai si l'entrée est un fichier.
The chdir, mkdir, rmdir functions are described in detail in the chapter on built-in functions.
An example of a use case that displays the contents of a directory:
dir monrep = opendir("/chemin") while forever text t = readdir(monrep) if t = nil break if t[0] <> "." print t /while
After an open statement, the error .../error constructor must be executed in the event of an access error. But the interpreter can stop the program before reaching the design. Otherwise, the contents of the block will be executed in the event of an error.
Syntax:
xxx.open("nom fichier") error ...instructions... /error ou: xxx.open("nom fichier"); error ? action ou: xxx.open("nom fichier"); error action
Example:
file monfic monfic.open("nom", "r") error? exit()If the file is not found or cannot be opened, the program stops.
Visibility rules refer to basic procedural languages, not scripting languages.
Scriptol adds security rules, it does not allow you to assign the same name to two objects in nested areas (for example, in the global scope and function). But the same names can be repeated in consecutive places.
There are four levels of visibility: - global, - class, - function body, - and the body of the control structure.
The visibility of a variable is the level at which it is declared: Global, class, function or restricted block (if, do, for, etc.), as well as content levels.
You cannot re-write a variable where it remains visible. It can be re-declared only if its area is closed, within sequential functions or control structures.
The assembly header for is part of the block area.
for text t in a t est visible seulement dans la boucle for. t = a.inc() /for
The portion of let that terminates the while loop is in the loop area .
Function arguments are in the scope of the function.
Within a function, if a variable references before assignment, it references a global variable if it exists, otherwise it is an error.
In a class method, if it is mentioned before assignment, it refers to an attribute if it exists, otherwise it is an error.
Global variables are not visible in the class except external variables.
External variables (from PHP, Apache, etc.) are always in the zone, since there is no control over them. Therefore, you must know their name so as not to reuse it, since Script variables turn into a PHP variable with $ in front.
When using external variables in a function, they must be declared "global," since the compiler does not manage them.
PHP or C++ functions, variables, and constants can be used in Script code, such as Script objects.
Their visibility is external, so they are visible as global class objects.
PHP variables and constants can be used as Script variables and constants when declared with the keyword "exter."
External announcements, like included ones, are placed in the file header.
Syntax for external variable:
extern type identifieur extern constant type identifieur
No external object type or scope checks. The function requires a "global" statement.
Example:
global argv array a = $argv
The PHP constant is declared as a variable with the keyword "constant":
extern constant text PHP_VERSION ... print PHP_VERSION
You can also use a PHP or C++ variable without an announcement with the prefix $ followed by an identifier.
It can start with an underscore.
$var_name $(constant_name) in PHP $constant_name. in C++
PHP functions can be used without declaration, which does not happen with C++ functions.
They can also be declared the exter keyword. The default value is determined by the destination. This value is used in C++, it is ignored by PHP.
Syntax and example:
extern type identifieur(... arguments...) extern text substr(text, int, int = 0)
To use PHP or C++ class methods, you must declare these classes and the elements you want to use.
Example:
extern class phpClass int phpAttribute void phpMethod(int argument) ... déclaration ... /class /extern
C++ allows you to define types with "typedef" and "# define" directives. These new types can be integrated with the selected Script statement.
Example: define uint
This corresponds to "# define uint unsigned int" in C++.
No code is generated by define: C++ code must be in the C++ file to be included. See the "Instruction Malfunction" section for details.
If you want to insert PHP code directly into your program, use ~~ characters to determine the beginning and end of the code you want to include.
The compiler ignores the content as if it were comments, but includes it in the generated code, PHP or C++.
You can insert specific PHP or C++ code into one program.
- To insert PHP code, use:
require_once («lecode.php»)
This statement has an effect only for a PHP interpreter compiled in C++, it is ignored.
- To insert a C++ code, use:
# include "lekode.c + +"
This will be compiled in C++, but for the PHP interretor it is a comment .
A class is a structure that contains variables (attributes) and has functions (methods).
Once a class is defined, it becomes the new complex language type by which objects, instances of the class, are declared. Object attributes and methods are used with the figure command:
x = objet.attribut objet.methode()
The class description begins with the keyword "class" and ends with "/class. "
Attributes (variables) must be placed before elements. The class opens a scope. Global variables and defined functions are not visible within the class. The attributes and methods of a class or instance of another class are visible in all methods of the class with the instance name in the prefix.
Exemple d'une déclaration de classe: class voiture ...membres... /class Exemple de classe avec attributes et méthodes: class voiture int lavitesse = 50 int passagers = 4 void voiture.vitesse(int i) int x = lavitesse * 2 return x /class Exemple d'instance avec référence aux méthodes: voiture mavoiture print mavoiture.passagers print mavoiture.vitesse()
A constructor is a method with a class name that is called when an instance of a class is created.
He always has a return type of "void," which means: nothing.
Example constructor:
class Voiture int vitesse void Voiture(int p) ` cette méthode est un constructeur vitesse = 0 ` vitesse est initialisée lors de la déclaration d'une instance return /class
Syntax for instantiating:
Nomclasse nomstance = Nomclasse (argument [, arguments])
or:
Name class for constructor with no arguments
Example:
Voiture mavoiture = Voiture(60) ... crée une voiture avec une vitesse de 60 Camion moncamion ... equivalent à ci-dessous Camion moncamion = Camion()
It may be convenient to collect all functions related to the task into one class and declare them "static." You can call these functions directly with the class name without having to create an instance .
Example:
node, ext = Dir.splitExt(chemin)
Attributes can also be static. A static attribute is common to all inherited instances. A static method cannot reference attributes because they exist only in instances of the class unless they are also static.
Another method cannot be called in the body of a static method.
The keyword "static" must precede the object type.
An error message is issued when a static function uses a non-static attribute or calls another method.
Example of static attributes and methods:
class Voiture static usine = "Xxx" static void denomme(text x) usine = x return /class Voiture.denomme("nom") Voiture.usine = "nom"
Static attributes and methods can also be associated with an instance:
Voiture maVoiture maVoiture.denomme("nom") maVoiture.usine = "nom"
The effect will be the same.
A class can inherit attributes and methods from another class if it is declared a subclass of another class.
The name class inherits the attributes and methods of "Austrian." It also works with static attributes and methods.
Inheritance declaration syntax:
class nom is autrenom
Example:
class Vehicule int fuel void Vehicule() fuel = 100 return /class class Voiture is Vehicule int passagers void Voiture() passagers = 3 fuel = 50 return /class class Camion is Vehicule int charge void Camion() fuel = 200 charge = 1000 return /class Camion bibendum Voiture daisy print bibendum.charge attribut de la classe Camion print bibendum.fuel attribut de la superclasse Vehicule print bibendum.passagers mauvais! passagers non accessible à Camion! print daisy.passagers bon, passagers est attribut de Voiture
The method can be overridden with different arguments, both in the same class and in derived classes. Return type of all method versions must be the same.
Example:
void ajoute(int x, int y) void ajoute(real x, natural y)
You just need to call the "add" method with the desired type of arguments, the compiler associates the corresponding definition...
The target C++ language requires that overloaded methods have the same return type that Script stores.
NOTE: Static XML is only currently implemented in the interpreter.
The Script binary compiler uses the dom class with similar methods and requires a libdom.sol file describing the class.
The Script compiler in PHP does not currently recognize XML.
In the future, this chapter will also apply to compilers.
XML is a data structure in Script. An XML document is defined as lightweight and then used to store and deliver data, simply as a class, with more flexibility.
The XML document can be used statically, only the content of elements and attribute values change.
An item is accessed by a grouped list of item names containing the item.
dom.document.client.getData()
Methods also allow you to change the structure, add or remove elements. This is discussed in the Dynamic XML section.
The XML document can be included in the source scriptol in a "light" form, without angle brackets.
XML structure syntax:
xml [name] ... un nom optionel pour le document. [headers] ... des éléments d'en-tête optionels. [doctype] ... des "doctype". tag ... un ou plusieurs éléments balisés. /xml
Heading
Syntax:
<? identifieurs et attributs ?>
Doctor
Syntax:
<! identifieurs et attributs >Please note that this ends> and no!>
Element
The marked element has the form:
nom [attribut [[,] attribut]* ] une liste d'attributs optionels [nom2]* aucun, un ou plusieurs sous-éléments. text ou un texte. ... / nom le nom de l'élément ici est optionel;
If the attribute list continues on the next line, the comma must be at least at the end of the line.
An XML document declares itself as a class between XML and/XML markers in a lightweight format.
xml nomdocument nomelement [attributs] "données" ou ~~ données sur plusieurs lignes ~~ ou éléments imbriqués / nomelement /xml
XML instances are then declared.
nomdocument instance1 nomdocument instance2
Instances are created at compile time, changes to the document at run time will not be found in instances.
External documents are loaded into Script using the "load" method, and the file name or path is loaded into the parameter.
xml x /xml x.load("demo") ou: x xinstance xinstance.load("demo")
A document loaded and completed or defined in a Script source is saved using the save method and the file or path name as a parameter.
You can assign an XML instance to a document. To do this, you must declare the main XML document empty to declare an instance before assigning it.
Example with the above name.
xml dom /xml dom instance1 = nomdocument
The contents of "instance1" are now the contents of the "nomdocure" document.
You can create as many instances of "home" as you want.
An iterator is a set of methods that can be used with tag methods.
Tag methods are associated with the name of the document or document instance, but refer to the currently specified tag.
To view the contents of a document or instance, use an iterator consisting of several methods:
reset() aller au premier élément du document. begin() aller au premier élément du niveau courant. inc() pointer sur l'élément suivant. found() retourne vrai si un élément est trouvé par la méthode inc() ou down(). down() pointer sur l'élément contenu. up() revenir à l'élément contenant.
You can display the document using the following methods:
end() aller au dernier élément du même niveau. dec() pointer sur l'élément précédent.
Example of using an iterator:
demo.reset() demo.down() while demo.found() print demo.getData() let demo.inc()
The iterator operates at the document level. To achieve a specific content level, use the at () method with a string list of content level names.
xml demo document element "data'" / element "data" / / /xml demo.document.element.at()
We are at the level of the "element" contained in the document. The reset () method returns the current element at the beginning of the document.
The content of the element is accessed by two tag methods - getData and setData:
text getData() retourne le contenu. void setData(text) change le contenu.
These methods are associated with the document or instance name and relate to the current item .
nomdocument.getData() instance1.setData("quelque texte")
You can access an attribute such as a dictionary entry. The attribute is recognized by name in the parameter of the getAttribute () or setAttribute () function.
xml doc elem1 att = "valeur" /elem1 /xml print doc.getAttribute("att1") doc.setAttribute("att1", "nouvelle valeur")
You can use an XML document instance as a function argument and return it through the function.
The argument is a new instance, not a pointer to the original instance, and the returned object is also a new instance.
You can define an XML document in the function. If the document should be returned by the function, then a pointer to the document will be returned to increase the speed of execution.
xml dom /xml dom mafonction() xml demo nomelement "contenu" / /xml return demo dom x = mafonction() print mafonction()
This chapter describes the functions for modifying the structure of an XML document or instance.
void clear () Erases the contents of the document.
XML Add-in (XML)
Adds a child to the current document item. The new element becomes the current element.
xml demo doc / /xml xml element inner "quelque texte" /inner /xml demo.addChild(element)
xml addNext (xml)
Adds an item after the current document item.
The new item becomes the current item in the document.
Méthodes Définitions ------------------------------------------------------------------------------------ xml addChild(xml) Ajoute un descendant à l'élément courant. xml addNext(xml) Ajoute un successeur à l'élément courant. xml append(xml) Ajoute un autre document à la fin du document. Retourne le document augménté. xml at() Retourne l'élément pointé, sous forme de document XML. xml at(text) Pointer sur un élément dans le niveau, son nom en paramètre. xml at(text, text) Pointer sur un élément trouvé par l'attribut et sa valeur, en paramètres. xml begin() Pointer le début du niveau. Concrètement, sur le child du parent de la balise courante. void clear() Efface le contenu du document. xml clone(xml) Copie le contenu du document dans le document en paramètre. void display() Affiche le document. xml down() Aller sur le premier sous-élément de la balise courante. boolean empty() Retourne true si le document ne contient aucun élément. xml end() Aller sur la dernière balise du niveau. boolean found() Retourne true si dec ou inc ont atteint une balise, false sinon. text getData() Retourne le contenu de la balise courante. text getValue() Retourne la valeur de l'attribut en argument. boolean hasAttribute(text) Retourne true si l'attribut en argument existe dans la balise courant. xml inc() Pointe la balise suivante. int length() Retourne le nombre de balise dans le niveau. boolean load(text) Charge le fichier nommé en argument dans le document déclaré. xml reset() Va au premier élément du document. boolean save(text) Sauve le document dans un fichier nommé en argument. Retourne true si ok. void setData(text) Modifie le contenu d'une balise. void setValue(text, text) Modifie la valeur d'un attribute, ou le crée. xml up() Va au premier élément qui suit le conteneur de la balise courante. void xml([xml]) Constructeur, avec en option un autre document comme source. ------------------------------------------------------------------------------------
Syntax to include an external Script file:
include "nomfichier.sol"
Brackets are optional. Single or double quotes are required. If you want to use the PHP file directly and the compiler does not process it, see below.
Only files with the extension. "Sol" will be processed by compilers if it is different:
- solp (php) ignores the statement.
- solc (c++) will issue an instruction to the C++ compiler.
If, on the contrary, you wanted to include the file in the generated PHP code, and not in the C++ code, you can use the require_once function ("file name"), which will be ignored by the compiler in C++ solc, since dynamic insertion cannot be performed in C++.
This statement allows you to define new types that the parser can recognize, such as primitives or classes.
You can use a function as an argument to another function by defining it as a type. It only works globally, not in the classroom. Once a type is defined, it cannot be overridden.
1) define a function:
Example:
int compare(int a, int b) boolean b = (a < b) return b
2) determine the type using this function as a model:
define COMP = "compare"
3) define another generic function that will use this function as an argument:
void mafonc(COMP a, int x, int y) print a(x,y) return
4) use generic function:
The argument can be a source function or another function with the same arguments and return types.
mafonc("compare2", 10, 8)
You can now define another function, such as "mul," from the same model, so with the same type of return and arguments as the "add" function, and use it instead.
mafonc («mul», x, y )
Syntax:
define NOVINTYPE
define NOVINTYPE as
creates a new type that can be used in external function arguments. See GTK examples for external type usage.
The " as" modifier causes the new type not to be considered a pointer. So use it as a primitive, for example, as a screw or gint.
Scriptol can use PHP functions. There is no control over the arguments and return types of PHP functions.
You just need to configure php.ini so that the extensions are visible to the PHP interpreter.
The most common PHP functions are included in the Script library.
To use PHP library functions in an executable program, you will need to write an interface to include in the project. phpgd.h and phpgd.cpp are an example .
The function library in C or C++ can be used simply by adding the .lib or .a or .so file to the list in the .ini or .cfg configuration file.
To display the variables and classes of the added extension, the compiler needs to write the file to be included.
The define statement allows you to create a type to define a function as a parameter to another function.
You can directly declare C variables:
extern ~~extern char *message~~ pour le fichier d'en-tête. char *message pour la visibilité en scriptol. /extern ~~char *message~~ création effective de la variable C.
Equivalence:
C ---------------------------------------------- char * cstring void * object char ** cstring * unsigned char byte
- The name of the function funname in the argument is written as funname, see define.
- Internal function cannot be used as an argument. It must be encapsulated in a custom function.
- If an instance is declared in the form C++: NameClass, a pointer must be created instead (depending on the form C++: NameClass * instance).
These functions are common to PHP, C, C++, and Script. If the PHP name is different, it is listed.
The full list is in the fun.hpp file.
void die(text message) Affiche un message en quittant le programme. void exit() Quitte le programme. Peut afficher un message. number min(number, number) Retourne le plus petit de deux scalaires. number max(number, number) Retourne le plus grand de deux scalaires. constant cstring plural(int x) Retourne le pluriel "s" si le nombre x > 0. array range(int x, int y) Génère un tableau des entiers compris entre x et y. cstring str(number) Convertit un nombre en chaîne de charactères. void swap(dyn, dyn) Echange le contenu de deux variables. text pad(text t, len l [, text c ] [, int o]]) Complète un texte avec des espaces ou la chaîne de caractères donnée. t: text à compléter. l: longueur à atteindre. c: texte à ajouter, des espaces par défaut. o: option STR_PAD_LEFT, STR_PAD_BOTH, par défaut à droite. (Voir: str_pad)
Cast
text chr(integer) Retourne le charactère pour une valeur ASCII. Ex: chr(32) retourne un espace blanc. int ord(text) Retourne la valeur ASCII d'un charactère. int intval(any) int doubleval(any) natural naturalval(any) text strval(any) Convertit un nombre en text. char *str(any) Convertit un nombre en chaîne de charactères C. boolean boolval(int)
File functions (see also File type methods):
void exec(text) Passe une commande au système d'exploitation. boolean file_exists(text) Teste si le fichier dont le nom est en argument existe. number filesize(text) Retourne la taille. number filetime(text) Retourne la taille (utiliser la fonction date pour afficher). text filetype(text) Retourne "dir" ou "file". boolean rename(text, text) Renomme un fichier. Retourne faux en cas d'échec. void system(text commande) Passe une commande au système d'exploitation. boolean unlink(text) Efface un fichier. Retourne true si effacé.
Directory functions:
boolean chdir(text) Change le répertoire courant. Retourne false si échec. boolean mkdir(text) Crée un sous-répertoire. Retourne true si créé. boolean rmdir(text) Efface un sous-répertoire. Retourne true si éffacé. text getcwd() Retourne le chemin répertoire courant.
Mathematical functions:
number abs(number) Retourne la valeur absolue d'un nombre. real acos(real) real asin(real) real atan(real) number ceil(number) Retourne le nombre arrondi à l'entier supérieur. real cos(real) real exp(real) number floor(number) Retourne le nombre arrondit à l'entier inférieur. number fmod(number, number) Return le modulo de deux nombres. real log(real) number pow(number, number) Retourne la puissance n d'un nombre. int rand() Retourne un nombre aléatoire. void randomize() Démarre une séquence de nombres aléatoires. real round(real) Arrondi au plus proche, plancher ou plafond. real sin(real) number sqrt(number) Retourne la racine d'un nombre. real tan(real)
Time functions:
int time() Temps en millisecondes depuis le 1 Janvier 1970. dict localtime() Temps et date courant lors de l'appel, dans un dictionaire, voir ci-dessous.
Dictation key returned by localtime:
tm_sec Secondes après la minute [0,61] tm_min Minutes après l'heure [0,59] tm_hour Heures après minuit [0,23] tm_mday Jour du mois [1,31] tm_mon Mois à partir de Janvier [0,11] tm_year Année depuis 1900 tm_wday Jour à partir de Dimanche [0,6] tm_yday Jour depuis le 1 Janvier [0,365] tm_isdst Indicateur d'heure d'hiver
This chapter will replace the Static XML and Dynamic XML chapters.
What is described here is functional in the Script compiler in C++, and will remain compatible with the new, simpler way of using XML, which is currently implemented in the interpreter.
Overseas Department of France
To use an XML document, you must create a dom instance. The dom tree is then populated with the build () method:
house world
mondom.build ()
Use the display method () to display the document.
To save it, use the save () method with the file name in the argument. In both cases, the dom argument. LIGHT makes presentation easier. You can assign a document in one house to another house using the assing method.
Road
Once the tree is created, you can access data and element attributes using the dom methods.
But Script has a special syntax for hovering over an element in a document. Nested elements and elements are treated as objects and subobjects:
Syntax:
instance [.nomelment] * "[" attribute-name: value"]"? [.nom-method (arguments)]
- is the name of the dom instance,
-The period followed by the name of the element
- is for each sub-element,
- a pair of attributes: a value in square brackets if we want to choose an element from several identical names,
- is the point followed by the method and its arguments.
If you just want to point to an element, you use the at () method.
But any other method of the house can be added to the element path. See the example demoxml.sol.
Read and write
You can read and modify the value of the attribute as you would for data.
- getValue (attribute name) returns the attribute value in the argument.
- setValue assigns a value to the attribute.
- getData () returns data.
- setData (text) changes or assigns the specified text to the parameter.
Data can also be assigned directly:
mondom.unelement.souselement.setData("quelque texte") ou mondom.unelement.souselement = "quelque texte"
Iterator
The dom class can also use a document as an XML stack.
The iterator is formed by several methods.
- begin() pointe sur le premier élément du document. - next() déplace sur l'élément suivant (dans le même élément conteneur). - up() déplace sur le successeur du conteneur. - down() pointe sur le sous-élément de l'élément courant. - found() retourne vrai si le successeur ou sous-élément existe, faux autrement.After an item is specified, the data is accessed by the following methods :
Insert and delete items
You can insert elements either as a sub-element, as a successor to a specified element, or delete a specified element.
Syntax:
nominstance.chemin.addNext(xnode) nominstance.chemin.addChild(xnode) nominstance.chemin.remove()
To insert an element, you must declare it in an XML document. You can move an item by inserting it in a new position and deleting the original instance.
HTML
The HTML page has the following format:
xml html ...content... /html /xml
Scriptol implements the declaration of Java objects, thanks to the "java" editor, and until the Java extension is enabled (see the entry: install).
Like the files that you want to use, you must import Java class files to use the content.
After you import a class, you can declare instances and call methods of the Script class.
The java source file must be compiled by the Java compiler into .class before importing.
Syntax:
import java cheminclasse-nomclasse ou import ... déclarations de classes ... /import
If the word "java" is at the beginning of the class path, the compiler identifies it and the modifier may be omitted:
Examples:
import java java.awt.Dialog déclaration valide import java.awt.Dialog est aussi valide import java MaClasse déclaration valide import MaClasse n'est pas valide pour une classe Java.
Declaring an instance of a Java class is similar to declaring an instance of a Script class.
Example:
java.awt.Dialog maDialogue ... ou simplement Dialog monDialogue MaClass monInstance
If "Dialog" is not declared by the Script class, you can skip the path.
Once an instance is declared, it is used like any other object.
monDialogue.setVisible(true) monInstance.disp() print monInstance.x
If you write your own Java class, it must be in a separate file with the class name, with the extension .java. It should be compiled by javaAC.
Exception handling is only supported in C++ and PHP 5 target languages.
Syntax:
extern class exception string what() /class /extern try ... quelques instructions ... catch(exception e) print e.what() /try
The preprocessor allows you to write scripting programs with keywords in any language.
To use it, you must:
1) list of keywords.
2) -t option on the command line (does not work with -w).
3) an entry in the solc.ini or solp.ini (or .cfg) file of the shape:
Keywords = extension
Extension - two-letter code depending on the language used, example:
Keywords = fr... for French.
The initial list of keywords is in the "keywords.en" file. If the language you want to use does not have a list, it must be created with each foreign word followed by an English equivalent (take keywords.fr as an example).
If a source-specific ".ini" or ".cfg" file does not have a Keyword entry, the -t option will be ignored for that file.
- symbols <- and ->.
-The string keyword is replaced by cstring.
- external char * declarations are replaced by cstring.
-The match operator and its definition are obsolete.
- methods on numbers are useless and suppressed.
-Used () for an empty array. Use {} or array ().
- the prefix for the PHP string is outdated and useless.