Developer forums (C::B DEVELOPMENT STRICTLY!) > Contributions to C::B
Using CTags as main parser
rickg22:
And don't forget that I'm STILL working on the codecompletion plugin!
Right now i'm optimizing the class browser, when i have that ready, i'll commit and start working on the parser.
Edit: But it's OK if you want to start working on your parser :) I don't want to hinder anyone.
eranif:
My parser is already completed - I have it ready and tested :D
I have the code written a year ago for an IDE of my (which I abanddoned).
ctags:
The good thing about using CTags - is the speed it can parse files, (it can parse hundreds of files in less then seconds), the additional flex based parser that I added was cause CTags cant parse local variables, So I used regular expressions + flex synatx to do that - works very good (it can handle template as well)
SQLite:
The SQLite DB is very portable and I would recommend it to anyone who wants to use a fast embedded database.
The idea is to parse the whole workspace when you start running (or use the db from previous runnings), and then let a thread parse the changes as they happen in the certain interval. I think that this is the best way of doing it - use cache (db) + runtime
Using db can be an advantage for other tasks as well:
- For example, Find a symbol in workspace - simply scan the db and offers the user the results, since it uses SQL, it is very straight forward.
- Code completion can be simply taken from the db ...
and other options as well.
I think that writting C++ parser from scratch is not very simple task, dont mention the bugs that it will contains ...
CTags is very mature tool that can help you do the parsing better - so I recommend ctags.
Eran
Michael:
--- Quote from: eranif on January 08, 2006, 09:47:26 pm ---The SQLite DB is very portable and I would recommend it to anyone who wants to use a fast embedded database.
--- End quote ---
Interesting to know. If it is so good it is worth an implementation-try in my project :).
--- Quote from: eranif on January 08, 2006, 09:47:26 pm ---I think that writting C++ parser from scratch is not very simple task, dont mention the bugs that it will contains ...
CTags is very mature tool that can help you do the parsing better - so I recommend ctags.
--- End quote ---
Implementing a parser from scratch is as you correctly said not a very simple task. Anyway, the complexity of the parser depend on your application's requirements. The implementation of a recursive-descent parser is "relatively" easy :). Naturally, it is not so fast as table-driven parser, but this is may be not so critical for you application. Sometime ago, I have posted about the C++ parser of a Mini-C++. See this topic for further information.
Michael
PS.: Is you parser open source and freely available for testing?
rickg22:
AH, so it's a recursive descent one! That means I still have hope with my rewrite :P
rickg22:
--- Quote from: Michael on January 08, 2006, 10:40:43 pm ---
--- Quote from: eranif on January 08, 2006, 09:47:26 pm ---The SQLite DB is very portable and I would recommend it to anyone who wants to use a fast embedded database.
--- End quote ---
Interesting to know. If it is so good it is worth an implementation-try in my project :).
--- End quote ---
That's interesting too, because in my version of the CodeCompletion plugin, which ironically, is incomplete :P, I use a trie to search for the tags. Eranif's implementation uses a database with indexes, which are themselves search trees.
I guess the main difference is that my index resides in memory, while eranif's resides on disk.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version