From: James M. D. <mdu...@ya...> - 2003-04-23 15:26:59
|
--- Grzegorz Jakacki <ja...@he...> wrote: > On Mon, 14 Apr 2003, James Michael DuPont wrote: > > [...] > > 1. the preprocessor > > 2. the lexer > > 3. the yacc > > 4. the trees (ast in gcc) > > 5. the rtl (in gcc) > > 6. the debug information(in gcc) > > > > All of these are just producing messages. > > we need to have a callback filtering system so that the user can > > register and subscribe to get the information needed. That will > > predicate a identifier system that allows addressing of any part of > the > > system with an identifier. > > > > This query system could be just a set of callbacks, each callback > would > > be a differnet type of function. > > > > of course that could be made into a set of classes with methods you > can > > override. Maybe even a generic function that would allow you to get > a > > fully instanciated object of a given type. > > In the framework I have in mind there is no callback registration. > The user of the framework supplies an object whose type is a class > with > overloaded operator(). Overloads are distinguished based on the > kind of nodes in the tree. Kinds of nodes can be just nodes types, > but not necessarily --- one kind can be implemented by many types > and vice versa. The framework takes tree node implementation, decides > what kind is it and calls the appropriate overload on user-supplied > object. So that is a form of a callback. By passing an object that supports a given interface where virtual methods are called, you have a call back scenario. > > > The treecc is good for defining all the types of nodes. the > question of > > limiting the view and scope of data is a separate one. > > I do not think that there is the universal set of types of nodes, > perhaps > cons/nil is the only common denominator. It is very much domain > dependent > and the framewok should not fix it. Take a look at SLT, which defines > just > requirements on types (concepts) of containers. STL algorithms can be > used > with any types, not only the ones defined in STL (standard > containers' > iterators). For an example: imagine somebody prepared universal set > of nodes > for C++ before Chiba invented OpenC++. Now comes Chiba and wants to > have > some nodes which represent arbitrary chunks of text inserted into C++ > parse > tree. Then he should create new nodes derived from the right part. (or supply template classes as you point out) >It is very unlikely, that the person who focused on inventing > "universal" C++ parse tree predicted Chiba's requirement. We are in > similar > situation. I am not saying we should handle all the nodes, but the ones we know about. mike ===== James Michael DuPont http://introspector.sourceforge.net/ __________________________________________________ Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo http://search.yahoo.com |