The last couple weeks have involved a lot of work with lex and yacc, which are two profoundly useful programming tools that are almost as old as I am. I've done a lot of work to re-vamp vtkParse.l and vtkParse.y so that they can parse much more of the C++ grammar, in fact they are able to parse each and every VTK class header file without any need to use //BTX, //ETX to block out the more complex bits. The new parser can do the following:
- Parse all operator methods and return them as e.g. operator->
- Return names for all types e.g. someclass<double>sometype
- Parse multiple classes per file, and store info for the one that matches the filename
- Parse templates, typedefs, enums, scoped names, simple math expressions, etc.
However, the most important feature is perhaps that it can parse complex instances of C++ grammar without choking… this has always been a major problem with the old VTK wrapper generators. There are still many features that I want to add, and I need to expand the FileInfo/FunctionInfo data structs that vtkParse uses so that it can store enum, template, and typedef information.
The parser can be found in my VTK on github and in WrapVTK.