|
|
Hi !
There's something I've been tossing around for some time: Parsing a
POVRAY scene, using a Parser built from flex and bison.
The idea is, that the parser generates an object-tree, than can be used
to generate the original scene (optinally: minus objects, that are not
referenced in the scene). Object in this context is everything from
Textures to Fog and geometric objects.
There would be several uses for this:
- pre-processor, to remove unused objects from the scene, remove
comments, unroll loops
- import POVRAY scenes into a modeller
- make scripts, that generate scenes from templates
I've done some first work on this, and I concentrated on textures first.
The current state of the code does nothing except parsing a file and
checking for syntax. There are a few problems, why I stopped this
project some time ago:
- The POVRAY syntax is very lazy, especially with textures. I used some
"strict" syntax, for example pigment-options can only be inside a
pigment - block.
- The mixture of vector and scalar expressions is difficult to parse. It
would be easier, if some explicit functions to convert between scalar
and vector would be used.
- It's difficult to find a clean object-structure for some of the POVRAY
concepts.
Questions:
- Has anybody else made a flex+bison parser for POVRAY scenes, where I
could get some ideas ?
- Is it possible, to write the POVRAY language in BNF notation ?
- Does anybody have some good ideas to store a POVRAY scene in memory?
Specification for this:
- not copied from the POVRAY source !
- easy manipulation of Objects (rearranging the tree)
- keeps ALL attributes of the Objekts
Jens Ch. Restemeier
Post a reply to this message
|
|