|
 |
Here's another one.
This time I start out entirely differently: This language isn't based on
description of hierarchical data, salted with control statements.
This time statements are the one and only thing: A scene file is a list
of statements.
For the sake of preventing ambiguities, and for the sake of consistency,
all statements are terminated by a semicolon unless noted otherwise.
For the sake of continuity, I'll use "#" as first characters of my
control statements again, and for the sake of simplicity I'll stick to
the few ones defined in the last proposal:
#if (CONDITION)
STATEMENT ;
#elif (CONDITION)
STATEMENT ;
#else
STATEMENT ;
#loop (IDENTIFIER)
STATEMENT ;
#break (IDENTIFIER) ;
#continue (IDENTIFIER) ;
A statement may be a block:
{
STATEMENT ;
STATEMENT ;
STATEMENT ;
}
A statement block is the only statement /not/ terminated by a semicolon.
A statement may be an assignment:
IDENTIFIER = EXPRESSION ;
An expression may be a scene element, such as a geometric primitive, a
texture or the like. Such an expression is comprised of a /type/
identifier and a statement block.
sphere { ... }
texture { ... }
A statement may also be a sole expression; in this case, the result is
"dropped into" the block it resides in, as a /child/ of the block:
foo = box { ... }
union
{
sphere { ... }
sphere { ... }
box { ... }
foo ;
...
}
Note how, in contrast to the current SDL, the object expression isn't
wrapped into "object { ... }".
Besides child elements, scene elements also have properties. The
following statement sets a property of the current block:
IDENTIFIER: EXPRESSION ;
All object properties are set via identifier, rather than anonymlously
by position; for instance, instead of
sphere { CENTER, RADIUS }
it will be:
sphere {
center: EXPRESSION ;
radius: EXPRESSION ;
}
Well, that's about as far as I've thougt this through for now.
Post a reply to this message
|
 |