Language specifications

The syntax of the language is similar to the PHP. This specification is very informal and mostly for those, who have already known something about programming.

Data types

Variables

Variables begin with the '$' symbol and they can contain whatever data type. They are not declared, but you have to set some value before they are first used.

They are divided to the locally defined in the functions and globally defined in the global context. If you want to work with global variable in the function context, you need to use get_global() and set_global() buildin functions.

Operators, priority of operators

Operators Description
(), -, !, ++, -- parentheses, unary minus, not, incrementation, decrementation
*, /, % mult, divide, modulo
+, - plus, minus
<, >, <=, >=, ==, != less, greater, less or equal, ...
&& logical AND
|| logical OR
=, +=, -=, *=, /=, %= assignment, plus and assign, ...

Commands

$a = 7;
$b = 5 + $a;

{
	$a = 7;
	$b = 5 + $a;
}

Conditions

if($a == 5)
	$b = 3;

if($a == 5)
	$b = 3;
else
	$b = "a is not equal five";

// Switch is not implemented

Loops

while($a < 10)
	echo("\n" + $a++);

for($i = 0; $i < 10; $i++)
{
	echo($i);
	echo("\n");
}

// Do-while loop is not implemented

Structured jumps

Break, continue and return structured jumps can be called. BUT!!! they are implemented by throwing exceptions so they can slowdown the program. You should consider their using!

Functions

// Return "some_value" string
function func()
{
	return "some_value";
}

$var = func();


// Return concatenated string
function cat($left, $right)
{
	return $left + $right;
}

$string = cat("left" + " middle ", "right");
$number = cat(1, 3);	// ;-)

Buildin functions

Function Description
echo(object) Print the value to the standard output
exit(object) Exit the script immediately
get_global("name") Get value of a global variable
set_global("name", object) Set value of a global variable

Including another scripts

include("/absolute/path/to/the/script.txt");
include("interpret/exe/relative/path/script.txt");

/*
// This is not allowed, the filename has to be string
// constant, it is evaluated by the preprocessor

for($i = 0; $i < 10; $i++)
	include("file" + $i + ".txt");	// Error
*/


// -I/include/path has not been implemented yet :-(

Arrays, structures, classes, etc.

Not implemented, sorry :-(

Valid XHTML 1.1
Valid CSS