
Here's a short grammar of the language. It should be pretty obvious for anyone
with a little background in grammars.

Items in braces can be repeated 

statement	->	level n
				variable = compare

compare		->	minmax { = minmax }
				minmax { > minmax }
				minmax { < minmax }

minmax		->	expr { min expr }
				expr { max expr }

expr		->	term { + term }
				term { - term }

term		->	power { * power }
				power { / power }
				power { % power }

power		->	factor { ^ factor }

factor		->	(compare)
				-factor
				factor
				+factor
				variable
				constant
				function1 factor
				function0


functions with no parameters: (function0)

		random

functions with one parameter: (function1)

		| 		(abs)
		sin
		cos
		int
		round

keywords:
		level


	*********************
	*	How it works	*
	*********************

The idea is that you define variables and that new lines in
the script will replace old lines. For a certain level, only
those definitions that appear before the next greater 'level'
statement will be used to define that level.

Order of evaluation is unspecified and there are no guarantees
that variables will have reasonable values unless they are
initialized. If a circular reference is encountered, an old
value of a looped variable will be used to get out of the loop.

For instance:

	a = b
	b = a + 1
	
If we evaluate a, we usually get 1 on the first round. This is
because most variables are initialized to 0. If we execute it
again, we get 2 etc. If, instead we evaluate b, we get 1, but
the value of a will be 0. I hope this is confusing enough so
that you will avoid circular references. Let's just say that
they are not very useful, but they do not cause problems.

The order of evaluation is on a "need to know basis". I guess
it's called intelligent recalculation in spreadsheet programs.
Let's look at it with a short example:

	a = 10
	b = a + 20
	c = 30
	d = b + a
	
If we then evaluate d, the system will try to evaluate b, notice
that b requires a to be defined, so it evaluates a and then b. It
then sees a again, but notices that it has been evaluated already
and uses the old value. c does not get evaluated at all.

Let's look at something more complicated:

	level 1
	
		b = a
		a = 1
		a = 2

	level 16
	
		a = 3

From levels 1 to 15, b will evaluate to 2, because that's the last
definition of a. From level 16, the value of b will be 3.

The definition a = 1 is not used at all, although it does get compiled
before the next line replaces it.

To actually define a game level, you have to define variables that of
interest to the game. These variables are introduced in a prescript
resource. Feel free to peek at that resource to see what variables are
available [during development, the prescript might be empty and the
Arashi Script file could contain everything].

Variables that are prefixed with an 'i' are by convention internal
variables. In the next part of the prescript, these variables are
connected with variables that you should use. For instance, we have
iFlipperCount and FlipperCount. You should use FlipperCount even though
iFlipperCount is really the variable that the game wants. This convention
allows us to scale or limit the values that can be set. For instance,
we should probably limit FlipperCount to a minimum of 0.
