I did some dependecy analysis on the cnd modules and here is what I found. * The current Antlr based parsers and their generated ASTs are not directly used by any module in cnd (such as Code Completion, Navigator etc). Instead all modules depend on an AST-like code model specified in C/C++ Code Model API (cnd.api.model)
* The Code Model API has an implementation in cnd.modelimpl which contains the parsers and antlr grammar files. Internally, this module converts the parser's generated AST into the Code Model API. * There is clean code seperation between code model impl and api; Only API module is used in rest of the cnd modules without knowledge of the implementation details (cnd.modelimpl is only used for test cases; cnd.modelui had dependency but it appears in some package related to tracing so I assume its debug). * The other module containing an Antlr file, Abstract Preprocessor Tree (cnd.apt) is only a dependency for cnd.modelimpl. cnd.completion has it listed as a dependency but no java file imports anything from that module. cnd.modelui again uses it only in a trace package. So cnd.apt is related only to model implementation. * There are some modules with name "clank" in them. These can be completely removed because by default they are disabled using system flags. It seems to be an experimental clang integration that was never used. Based on these observations, I think we can safely get rid of all Antlr files by targeting the Code Model Implementation module. My suggested plan of action would be: 1. Introduce a clang based parser alongside the existing parsers. Look at class org.netbeans.modules.cnd.modelimpl.parser.ParserProviderImpl. This currently contains two C++ parsers: Antlr2CppParser and Antlr3CXXParser, with the antlr 2 being used by default. The parsers have a parse method which does parsing into custom AST and a render method where custom AST is used to create Code Model API objects. The render method is where we will need mapping between clang AST to code model api. ( I am trying to find good tutorials about clang AST) 2. Once we test the clang parser, we can focus on cnd.apt. This package does have some clang translation support with stuff such as compilation db, so eventually it can be completely removed if successfully transitioned. 3. Finally a lot of code can be simplified. Particularly, the indexing is happening at the same time as parsing. This needs to be moved over to the Indexing API like it is done for java. I hope that with this approach we can keep up with latest C++ language releases while not having to sacrifice any of the functionality in the cnd module. Siddhesh --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org For additional commands, e-mail: dev-h...@netbeans.apache.org For further information about the NetBeans mailing lists, visit: https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists