SCHIZA script language description

INTRO:
first of all: writing programming languages is a great fun !
now, after implementing SCHIZA I know why does quake has its own
language, while this is inefficient and not realy needed ;)
Cormack wanted to have some fun ! possibly after writing all
those 3d stuff ... ;)

DESC:

* everything is case sensitive, i.e. blah and Blah are two diffrent things.

* all white spaces (including new lines) outside quotes are silently 
squeezed into one space, so : 
print
(        "hello"     );
and
print("hello");
are equal.

* ``"hello " "world"'' == ``"hello world"''

* expression is boolean false is it is 0 or empty string, true otherwise.

* ``=='' is used for comprasion and ``='' is used for assigment, so that
``if (n = 12) { ... }'' assigns 12 to n, and checks whatever it doesn't
equal zero, so it is eqivalent of ``n = 12; if (n != 0) { ... }''

* variables and contsants are strongly typed, so assigning number to 
string won't work (and vice versa), you have to use conversion function.

* instruction is either a expression followed by a ';', keyword followed 
be some other keyword-dependent parts, or a block of instructions in 
``{}''.

* expression is etiher a value, a value followed by a postoperator
(++, --) or a value prefixed with preoperator (-,+,--,++,~), or
a expression follwed by a two-arg operator and a value (with
optional pre/post-operators).

* a value is either:
	- a exporession in ``()'';
	- a variable name (referring this variable); 
	- a function name, followed by a ``('', optional 
	comma (``,'') separated exporessions (arguments) 
	and ``)'' (this reffers to variable returned by this function);
	- a numeric constans; 
	- a string constants; 
	- a hash dereference - hash name follwed by ``['', 
	expression resulting in string or number, ``]'',
	or hash name, ``{'', word interpreted as a string, ``}'';
	- a array derefrance : array name, ``['', expression 
	resulting in int, ``]''. only strings can be used as arrays
	at the moment
so:
	(2 + a)
	var
	some_function()
	12
	0x12dead
	01234567	# octal
	hash_name[a + "_" + b]
	hash_name{blah}
	some_string[12]
are all valid values.
	
* string is zero or more chars enclosed in double quotes:
	"some string"
string can contain \escapes:
	\n	newline (10)
	\r	cr (13)
	\t	tab (9)
	\e	esc (27)
	\cX	ctrl-X (where X is anything)
	\x12	hex escape
	\012	octal escape

* identifiers consists of latin letters 'a' ... 'z', 'A' ... 'Z',
digits '0' ... '9', '_' and '$'. identifier has to start with either
a letter or '_'. variables starting with '$' are magic, and shall
not be used to define normal variables. identifiers cannot be
keywords.

* keywords include:
	- int : definition of integer variable, it can be follwed by
	  an initial expression to assign to it, like this
	  
	  int blah = 2 + some_other_blah + func_call();
	  int a, b, c = 2;
	  
	- string : definition of string variable, same as for int's
	
	  string a = "heeh", b;
	  
	- ptr : definition of pointer variable, it's not implemented
	  yet ;(
	  
	- shash  : hash of strings
	
	  shash blah;

	  blah{some_key} = "yello";		# these two are
	  blah["some_key"] = "yello";		# same
	  
	  blah[some + expression_resulting() + "in string or int"] = "hehehe";
	
	- hash : also hash of strings, same as shash
	
	- ihash : hash of ints

	  ihash heh;
	  hah["jsshshsh"] = 12;
	  
	- phash : hash of poniters, not implemented yet.
	
	- break : keyword to break a loop, like this

	  while (some_condition) {
	  	do_some_thing();
	  	if (some_other == condition)
	  		break;
	  }
	  # break gets you here
	  
	  break can take a number parameter to break more loops:
	  
	  while (some_condition) {
	  	do_some_thing();
	  	for (;;) {
	  		xxx();
	  		if (some_other == condition)
	  			break 2;
	  	}
	  }
	  # break gets you here

	  this numeric param as you can see defaults to 1;
	  
	- else : second part of if statement
	
	- return : return from function, like this

	  proc f()
	  {
	  	if (haha)
	  		return 1;
	  	else
	  		return 2;
	  }

	  if function is not finished with return (ie control gets to
	  it's end), value returned is same as value returned by last
	  expression, so :

	  proc f() { return yello(); }

	  and

	  proc f() { yello(); }

	  are same. return can be used w/o expression, then void value
	  is returned.
	  
	- continue : same as break, but doesn't break the loop, but 
	  continues it from the begining :

	  while (kkk) {
	  	# continue gets you here
	  	xxx();
	  	if ((xx == xxxx()) == 0)
	  		continue;
	  	yyy();
	  }

	  can take numeric parameter which specifies which loop to continue;
	  it defaults to 1;
	  
	- while : a while loop, look like

	  while (condition) {
	  	block();
	  	of = instructions;
	  }

	  or

	  while (condition)
	  	instruction();

	  condtion has to be enclosed in (). instructions in block are
	  executed as long as condition is true (non-zero). condition
	  is checked before every iteration, so loop can be executed 
	  0 times (i.e. not executed)
	  
	- void : reserver for future use
	
	- if : conditional, like this

	  if (condition) {
	  	lalla();
	  	hehehe();
	  }

	  or 

	  if (condition) {
	  	lelele();
	  	sdjfsdf();
	  } else {
	  	kjdsfkj();
	  }

	  as usual block enclosed in {} can be changed to one instruction.
	  instructions in first block are executed if condition is true,
	  otherwise (if condition is false) second block is executed
	  (if it's present)
	  
	- proc : function definition statement

	  proc function_name(string arg1, int arg2)
	  {
	  	block(arg1);
	  	of();
	  	instuctions(arg2 + 2);
	  }

	  arguments are optional, and at the moment can be only of
	  type int or string.
	  
	- for : another loop statement, used mostly like this

	  int i;
	  
	  for (i = 0; i < 20; i++)
	  	blah(i);

	  blah() function is executed 20 times, with arguments from 0 to 19.
	  not that it could be written using while() loop, like this

	  int i;

	  i = 0;
	  while (i < 20) {
	  	blah(i);
	  	i++;
	  }
	  
	- do : do {} while() loop, same as while, but condition is checked
	  AFTER executing loop, so loop executed at least one time :

	  do {
	  	blah();
	  } while (condition);
	  
	- walk : this keyword is used to walk through hashes,

	  walk hash_name {
	  	instructions($key, $val);
	  }

	  when executing walk, magic variables $key and $val are
	  assigned respecivly index name and value of hash entry.
	  you CANNOT modify $val in walk (or rather it won't give
	  you anything). if you need to modify the hash do
	  
	  	hash_name[$key] = "something";

	  you can also add & delete members during hash walk.
	  however walk won't be executed for members added during
	  itself. hash member can be deleted by assigning them
	  void value, a good way to get a void value is to use
	  undef() builtin function.
	  
