ISL.BNF - Copyright (c) 1992 John T. Grieggs, last modified 10-28-92

Current ISL version - 1.0.

This file describes the BNF for ISL, the Imagine Staging Language.  BNF is
Backus Naur Form, a formal method for describing the syntax of a language.
It should be fairly clear from the BNF what is allowable and what is not.
This is a non-trivial document - I suggest you use ISL.doc to get an idea
of what ISL is and does and how it works, then play with the destage and
restage programs, and only then attempt to grok the grammar.

Before diving into the BNF, here are some things which are not in the BNF
which are true of the ISL grammar.  Feel free to ignore the regular
expressions and references to flex - they are included for the advanced
user and should not be needed to understand the language.

1)  Whitespace is optional.  You may have an entire stage on one line, or
    may start a new line between any two keywords.  

2)  STRING is a token which is bracketed by double quotes.  A legal string
    may contain 0 or more of the characters [A-Za-z0-9\.\/\_\:].  Or, in
    English, any upper or lower case letter, any digit, period, forward
    slash, underscore, or colon.

3)  U32 is a token which contains one or more digits.  It may not have
    a decimal point nor a sign.  {DIGIT}+ is the flex pattern used.

4)  FLOAT is a token which contains an optional minus sign, one or more
    digits, a period, and zero or more digits.  \-?{DIGIT}+\.{DIGIT}*
    is the flex pattern used.  Note that while six digits after the decimal
    are always emitted by destage, zero or more are acceptable.  More than
    five will bring you up against the Imagine rounding problems...

5)  I have not attempted to spell out the meaning of each U32, FLOAT, and
    STRING, on the theory that their meanings should be obvious based on
    their position in the grammar.  For example, in camerahdr, defined
    as CAMERA STRING, you have one keyword (CAMERA) and the name (STRING).
    In this case, STRING would be the name of the CAMERA from the first
    column of the Action editor.  A typical value for this clause would
    be CAMERA "CAMERA".

6)  : means definition, | provides alternates.  Eh?  Take the very first
    part of the BNF for an example.  A stage may consist of a stagehdr
    OR a stagehdr followed by a camera followed by globals followed by
    objects.  These, in turn, are defined individually.

7)  Optional clauses contain an empty : clause followed by one or more
    | clauses.  An example would be genlockflag which is either :
    (nothing) or GENLOCK.  The grammar is riddled with these, so make
    sure you get it.  A stage may have zero or more objects, each of which
    may have one or more positions, one or more alignments, etc.

Finally, here's the BNF:

stage
	: stagehdr
	| stagehdr camera globals objects

stagehdr
	: STAGE MAXFRAMES U32

camera
	: camerahdr positions alignments sizes

camerahdr
	: CAMERA STRING

globals
	: globalhdr globalchunks positions alignments sizes

globalhdr
	: GLOBALS STRING

globalchunks
	:
	| globalchunks globalchunk

globalchunk
	: ACTOR frames
	  BRUSH STRING U32
	  BACKDROP STRING U32
	  AMBIENT rgb HORIZON rgb +ZENITH rgb -ZENITH rgb
	  FOG btl FOG rgb
	  STARFIELD FLOAT TRANSITION U32 SKYBLEND U32 genlockflag

objects
	:
	| objects object

object
	: objecthdr filechunks positions alignments sizes hinges effects
	| lighthdr litechunks positions alignments sizes hinges
	| axishdr axischunks positions alignments sizes hinges

objecthdr
	: OBJECT STRING quickdrawflag

lighthdr
	: LIGHT STRING

axishdr
	: AXIS STRING

positions
	:
	| positions posnchunk
	| positions pth2chunk

posnchunk
	: POSITION frames xyz

pth2chunk
	: POSITION frames PATH STRING ACCEL U32 FLOAT DECEL U32 FLOAT

alignments
	:
	| alignments algnchunk
	| alignments palnchunk
	| alignments talnchunk

algnchunk
	: ALIGN frames xyz

palnchunk
	: ALIGN frames PATH yhorizontalflag

talnchunk
	: ALIGN frames OBJECT STRING YROTATION FLOAT FLOAT

sizes
	:
	| sizes osizchunk

osizchunk
	: SIZE frames xyz

filechunks
	:
	| filechunks filechunk

filechunk
	: ACTOR frames NAME STRING CYCLE FLOAT FLOAT reverseflag TRANSITION U32

litechunks
	:
	| litechunks litechunk

litechunk
	: ACTOR frames sccshape shadowflag diminishflag rgb TRANSITION U32

axischunks
	:
	| axischunks axischunk

axischunk
	: ACTOR frames

hinges
	:
	| hinges hingchunk

hingchunk
	: HINGE frames OBJECT STRING

effects
	:
	| effects effect

effect
	: EFFECT U32 frames Boing2.0 STRING
	  xyzaxis ucdsquash SHRINK FLOAT TIMES U32
	| EFFECT U32 frames Fireworks STRING
	  srlshape xyzaxis EXPLOSION FLOAT FLOAT SCALING FLOAT
	  ROTATIONS FLOAT FLOAT EXPANSION FLOAT DISTANCE FLOAT SEED U32
	  sparkleflag
	| EFFECT U32 frames Flash STRING
	  ON U32 OFF U32 startflag
	| EFFECT U32 frames Grow STRING
	  YROT FLOAT XSCALE FLOAT
	  ZSCALE FLOAT XTRANS FLOAT ZTRANS FLOAT
	  alignyflag keepxflag mirrorflag reverseflag
	| EFFECT U32 frames Ripple STRING
	  lrtoggle WAVELENGTH FLOAT ZAMP FLOAT TRAVEL FLOAT RIPPLES U32
	| EFFECT U32 frames Rotate2.0 STRING
	  xyzaxis DEGREES FLOAT
	| EFFECT U32 frames Tumble STRING
	  rzaxis ROTATIONS FLOAT FLOAT SEED U32

frames
	: FRAMES U32 U32

xyz
	: XYZ FLOAT FLOAT FLOAT

rgb
	: RGB FLOAT FLOAT FLOAT

btl
	: BTL FLOAT FLOAT FLOAT

xyzaxis
	: XAXIS
	| YAXIS
	| ZAXIS

rzaxis
	: RANDOMAXIS
	| ZAXIS

ucdsquash
	: +SQUASH
	| SQUASH
	| -SQUASH

srlshape
	: SPHERICAL
	| RADIAL
	| LINEAR

sccshape
	: SPHERICAL
	| CYLINDRICAL
	| CONICAL

sparkleflag
	:
	| SPARKLE

startflag
	: STARTON
	| STARTOFF

alignyflag
	:
	| ALIGNY

keepxflag
	:
	| KEEPX

mirrorflag
	:
	| MIRROR

reverseflag
	:
	| REVERSE

lrtoggle
	: LINEAR
	| RADIAL

shadowflag
	:
	| SHADOW

diminishflag
	:
	| DIMINISH

genlockflag
	:
	| GENLOCK

yhorizontalflag
	:
	| YHORIZONTAL

quickdrawflag
	:
	| QUICKDRAW

