|
Re: Configuring CDT [message #1432311 is a reply to message #1431225] |
Fri, 26 September 2014 23:58 |
Jeff Hopkins Messages: 5 Registered: July 2014 |
Junior Member |
|
|
I hope someone with a little more experience also answers, but I thought I'd share my team's experience...
The short answer is clearly "yes, it is possible". Since it understands C, it can certainly be made to understand something almost like C (where "almost like" might even mean "very different" ). Is it easy? That depends on your viewpoint. As far as we could establish, there wasn't a way to write a plug-in-to-the-plug-in by just dropping in, for example, our own independently written flex/bison-type lexicon and grammar, but the practical application wasn't much different, unsurprisingly. That may relate to what our grammar required (though most was very very straightforward, some was more involved) rather than the mechanisms available to accomplish the tasks. Or, easier mechanisms may have just been hidden by our ignorance.
We downloaded the core CDT source, read a few instructions, found the core parser project where the standard C syntax was identified (keywords, tokens) and were able to glue our own symbols and lexical interpretations in and around the existing rules. As I said, the practical application of that work looked very much like what we would have had to write externally anyway. The extra work was finding where to put it without perturbing the existing parsing beyond our needs. In the end it still works for our special syntax as well as all our standard C and C++ projects. I think we touched 7 files:
org/eclipse/cdt/internal/core/parser/scanner/Token.java
org/eclipse/cdt/internal/core/parser/scanner/Lexer.java
org/eclipse/cdt/internal/core/parser/scanner/CPreprocessor.java
org/eclipse/cdt/internal/core/dom/parser/cpp/GNUCPPSourceParser.java
org/eclipse/cdt/core/parser/Keywords.java
org/eclipse/cdt/core/parser/IToken.java
org/eclipse/cdt/core/parser/IPreprocessorDirective.java
Would I want to do it again from scratch? Not myself, but it wasn't so onerous that I would discourage anyone else from trying it if they are so motivated. I highly recommend the getting started page (wiki.eclipse.org/Getting_started_with_CDT_development). It is short, but there are tips that would have shortcut a lot our early struggles with plug-in development in general. I also recommend the developer FAQs (wiki.eclipse.org/CDT/Developer/FAQ).
I can secretly (not so secretly now) wish that someone would step in and answer "you did it the hard way" and show me how to do it with a simpler "list of rules" as you originally asked; but, I thought it was worthwhile to let you know our experience regardless.
|
|
|
Powered by
FUDForum. Page generated in 0.04660 seconds