From: Stefan S. <se...@sy...> - 2005-03-05 06:33:22
|
hi there, many moons ago we have discussed whether or not it would be useful to expose the OpenC++ API to python and thus to allow to drive the process of parsing and code generation to be scripted. As part of synopsis I'v done some experimentation, and attached to this mail are some first results. The file is a python script that uses python modules 'PTree', 'SymbolLookup', and 'Processor' to access the respective APIs directly (this implements the design I posted earlier last summer). This particular example looks for function definitions and inserts comments containing the function's name at the beginning of each function block. Beside the advantage we had discussed earlier to remove the need for (portable) management of sub-processes, dynamic modules, etc., there are also other advantages I can see: With such a scripting approach, I'm seriously wondering whether there is still a need to 'augment' the code in-place, essentially changing the programming language. Why not store the rules that drive the code manipulation outside the code, as part of the script that drives the processor ? I have got quite positive comments from users who expressed concern that the form of metaprogramming promoted by OpenC++ would require users not only to be expert in C++, but also to know the additional dialects to use to drive the code generation. What do other OpenC++ users think ? What is the advantage of this form of metaprogramming as opposed to scriptable code manipulation driven by external rules ? I'd appreciate any feedback, Stefan |