From: Stefan S. <se...@sy...> - 2004-09-01 00:27:35
|
Gilles J. Seguin wrote: > Templates make a C++ parser at least 'x' times harder. > Can you explain how we can handle template specialization with current > parser. > > What I understand, > - specializing templates requires that the tokens for a template > declaration be saved so that the template can be reprocessed when the > actual template arguments are specified. I'm not sure whether that is necessary. It might be if you wanted to do some validation such as make sure that the types on which a template should be instantiated fulfill the requirements of the template. I don't think this is all that useful at the moment. Existing difficulties in resolving ambiguities during template parsing aside, I believe everything we need is already in place. The parser can parse both template declarations as well as template specializations. We only need to look up the first when we run into the second. All we need is an environment... > - it requires the syntax phase to perform near-complete type, scope, and > expression analysis, including function overloading. Right, it would, if we tried to validate the code. > So my believed is that we need to rejuvenate the design. > But my question is how. Functionality-wise I believe the big issue is with ambiguities the current parser can't resolve due to the two-phase parsing. We should try to merge these two phases into one, as we discussed in another thread. Another issue is that of the code being quite monolithic. Now that I'v had some first cut at a refactoring I'm more convinced than ever that it is possible to clear up the code substantially, and thus make it simpler to use and enhance (the old topic of a new AST API on top of the PTree stuff comes to mind !). As far as synopsis is concerned, I'm looking into exposing these APIs to python and then being able to script on top of that. That would remove the need for a complete, portable C++ application frontend, i.e. I believe it's far easier to write an 'occ' application in python, where running subprocesses and loading plugins is far more simple and portable then doing the same in C/C++. Just imagine, we could completely drop all this libtool / lddl business...! Regards, Stefan |