POV-Ray : Newsgroups : povray.programming : Custom povray scene file reader (parse.cpp + tokenize.cpp) : Re: Custom povray scene file reader (parse.cpp + tokenize.cpp) Server Time
17 May 2024 08:20:03 EDT (-0400)
  Re: Custom povray scene file reader (parse.cpp + tokenize.cpp)  
From: Ken and Timi Cecka
Date: 7 Mar 2006 22:28:03
Message: <440e4f43@news.povray.org>
human_2.0 wrote:

> I want to make a povray scene file reader to convert the files to a
> different format.  I thought I could do it from scratch, but I'm finding
> little catches all over.  I've not studied lexers much.  I was just
> thinking that writing a custom binary with povray's own parse.cpp and
> tokenize.cpp would probably be the easiest solution, and have it print out
> a list of obects or something like that.
> 
> Would this be easier for someone unfamiliar with the povray source code
> than
> writing my own parser?  I code in Perl mostly but can read c++.

A number of years ago, Christian Vogelgsang announced an independent pov
parser which he called libparpov, and released along with a povray to
renderman converter utility.  The original page is gone, but you can find
an archive of it on the wayback machine:

http://web.archive.org/web/*/http://www9.informatik.uni-erlangen.de/~cnvogelg/pov2rib/index.html

The February 2, 2002 link seems to be the last working copy.

Christian's parser was written using PCCTS (the Purdue Compiler Creation
Toolset), and implemented most or all of the Pov 3.0 SDL.  Note that 3.0
did not include macros.

I've recently been working on writing my own parser using ANTLR (the modern
incarnation of PCCTS), and have it far enough along to handle all the
language directives (macros, declares, includes, etc).  I've only
implemented a handful of object types and basic pigments in the core
language so far though as I'm focusing on getting them working in my end
application before I finish off the parser.

If you can't get the original libparpov working, I can send you a snapshot
of some of my ANTLR code, but it will probably require more effort since I
haven't really packaged it up as a standalone library yet (nor is it
complete).

Ken


Post a reply to this message

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