POV-Ray : Newsgroups : povray.general : using flex and bison to parse povray scenes : using flex and bison to parse povray scenes Server Time
14 Aug 2024 05:17:45 EDT (-0400)
  using flex and bison to parse povray scenes  
From:
Date: 12 Feb 1998 15:00:47
Message: <34E354EE.6A4B@HRZ.Uni-Bielefeld.DE>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.