Re: [SimpleParse] How to "compile" the tree
Brought to you by:
mcfletch
From: Mike C. F. <mcf...@ro...> - 2003-07-19 14:26:17
|
Martin d'Anjou wrote: >>or just call the processor object with the tag-tree result-set and the >>data (the string source): >> >> > >Fantastic. I got my processor it to traverse the entire tree. Now, I would >like to output the result in a C++-like language. What should be the next >step? > Normally the next step is to model your domain as objects and have SimpleParse instantiate those objects so that you can process them in whatever way you want. For instance, OpenGLContext has a VRML 97 Node object model. It's ParseProcessor creates nodes from the parse-tree and then passes the tree off to OpenGLContext for interpretation. OpenGLContext doesn't know about the parse-processor's internals other than how to register objects to be instantiated, and the parse-processor only knows about the objects it's supposed to instantiate. In this case, OpenGLContext processes the tree by rendering it to a 3D window, but performing transformations and creating some form of output are about the same process in the end. SimpleParse really is a parser, not a compiler, it doesn't attempt to provide services beyond "loading data into an in-memory graph". So you won't find code in it for tree transformations or the like, that's all considered out-of-scope for the project. ... >I will have a bunch of tasks and functions doing things to stuff to car1 >like setting the color to red and the address to 723, hooks for repainting >etc. There will be lots of tasks, and each task will need to do things to >almost every class member. > >Should I put everything in myProcessor, or is there a better suited >approach that SimpleParse provides? > > Putting everything into ParseProcessor probably isn't a good idea. It's designed to walk a result tree and generate some domain-specific format, not to provide complex random-access operations on a tree/graph of objects/nodes. Have fun, Mike |