From: Grzegorz J. <ja...@he...> - 2003-04-23 13:12:15
|
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. > 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. It is very unlikely, that the person who focused on inventing "universal" C++ parse tree predicted Chiba's requirement. We are in similar situation. Thanks for your input. Grzegorz ################################################################## # Grzegorz Jakacki Huada Electronic Design # # Senior Engineer, CAD Dept. 1 Gaojiayuan, Chaoyang # # tel. +86-10-64365577 x2074 Beijing 100015, China # # Copyright (C) 2002 Grzegorz Jakacki, HED. All Rights Reserved. # ################################################################## |