Nathan's parser provides a good methodolgy for setting up a lex/yacc parser for POVRay scene definition file.

You can get the distribution in a .tar.gz tarball.

You should take a look at the README, parse.h, parse.cpp, povlex.l, povyacc.y files for a good place to start.

The files parse.h, parse.cpp contain the main routines for filling in your data structure (currently they only print to stdout) and are called from povyacc.y. The greatest benefit of using lex/yacc is that all you have to do is specify the grammar production rules---you do not have to parse the file yourself. Furthermore, the lex/yacc organization allows for fairly easy extensibility of the parser.

Also take a look at the included example scene.pov, hard.pov files. Although these files are not particularly effective examples (i.e., they don't exhibit reflections or refractions very well), the parser should handle both of these files successfully. These scenes contain spheres, texture mapping, and planes. Your ray tracer must be able to ray trace these scenes. Your ray tracer can handle other extensions (e.g., reflections, refractions, supersampling) by either extending the parser or via other mechanisms (e.g., command-line options). Before considering these extentions, you should of course consult the POVRay documentation to check whether the POVRay scene definition file allows for the given extensibility or not (it might, or it might not---some POVRay options also rely on command-line swiches).

POVRay of course also parses the example files successfully (see images below). You should run povray to compare your images to povray's. You can also try using KPovModeler to see whether you can generate interesting scene files interactively.