News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

I think these links helpful to redesign code completion plugin

Started by ollydbg, February 09, 2009, 03:37:15 PM

Previous topic - Next topic

ollydbg

VCF builder, It seems the development stopped two years ago :(.

GCC XML It use gcc as a internal parser, the current version is 0.9, can be download from sourceforge. But it seems template is not supported. examples are here: C code and Output Xml file

Stream-Based Parsing in C++ A general introduction article about parser a c++ file.

a simple c parser

parser at berkele








If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

alb_cb_moon

I found others links that coudl help:

Parsing C++: Maybe old, but interesting point of view: build a C++ parser is a task so though that the autor give up, had useful links
Fog thesis Meta Compilation for C++
Compilers and Compiler Generators text course of compilers using c++
YARD (Yet Another Recursive Descent Parser)
online papersEmbedded Input Parsing for C++
OS: Windows XP SP2
GUI Library: wxWidgets 2.8.10
IDE: CodeBlocks SVN / Nigth Builds Compiler: MinGW & gcc 3.4.5

alb_cb_moon

OS: Windows XP SP2
GUI Library: wxWidgets 2.8.10
IDE: CodeBlocks SVN / Nigth Builds Compiler: MinGW & gcc 3.4.5

ollydbg

@alb_cb_moon:
All the links are very interesting. I have a glance at codeLite's parser, it use a lex and yacc grammar. But I'm just concerning it's performance. (It use CTags to generate a database).The current design in  CC parses all the files in the current workspace as soon as it was opened.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

eranif

Quote from: ollydbg on March 17, 2009, 07:25:19 AM
I have a glance at codeLite's parser, it use a lex and yacc grammar. But I'm just concerning it's performance. (It use CTags to generate a database).The current design in  CC parses all the files in the current workspace as soon as it was opened.

1) codelite uses codelite_indexer which is an executable that uses ctags as library and provide indexing services to codelite over Unix sockets (*Nix) / Named Pipes (Windows)
2) the lex & yacc are PARTIAL grammars and they cannot parse an entire file, they are using the lookup table generated by the indexer
3) CodeLite will index workspace on startup only if this option is enabled (by default it is turned off) and subject to the next bullet:
4) indexing is smart: only modified files are being re tagged and constantly re tagged upon file saving (i.e. attempting to right click on the workspace and selecting 'retag workspace' will only trigger one retagg, for the second retag you get message in the status bar that says "All files are up to date"

Eran


ollydbg

@eranif
Thanks for your explanation.
So, the MAIN parser is a index service (which is based on Ctag's parser), the Lex&Yacc is used to  parse the "lookup table generated by the indexer".

I had thought that you use Lex&Yacc to build a parser to parse the source file directly. :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

eranif

Quote from: ollydbg on March 17, 2009, 03:46:39 PM
So, the MAIN parser is a index service (which is based on Ctag's parser), the Lex&Yacc is used to  parse the "lookup table generated by the indexer".

No, the indexer creates a database of tags collected from the entire workspace. It searches for declarations and implementations of:
- classes (include methods and variables)
- methods
- globals
- statics
- defines
- structs
- namespaces
- enums
- unions

The Yacc / Lex are used to resolve expressions:
GetManager()->GetWxString(). // completion here is resolved by the yacc grammar (and additional code)

Eran

ollydbg

Quote from: eranif on March 17, 2009, 04:19:20 PM
Quote from: ollydbg on March 17, 2009, 03:46:39 PM
So, the MAIN parser is a index service (which is based on Ctag's parser), the Lex&Yacc is used to  parse the "lookup table generated by the indexer".

No, the indexer creates a database of tags collected from the entire workspace. It searches for declarations and implementations of:
- classes (include methods and variables)
- methods
- globals
- statics
- defines
- structs
- namespaces
- enums
- unions

The Yacc / Lex are used to resolve expressions:
GetManager()->GetWxString(). // completion here is resolved by the yacc grammar (and additional code)

Eran
Ok, Thanks!
I understand now. It is a good idea to use Yacc&lex grammar to parse the context expression to give a correct tips. :D
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

Here is another one we can use for CC

http://qt.gitorious.org/qt-creator/qt-creator/trees/master

I have read it's source code, find that they use some code from "Kdevelop". You can see

QTcreator\src\libs\cplusplus\pp-engine.cpp

:D

But these code were too complex to understand. :(
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

link added
Hyperlinked C++ BNF Grammar

But to my knowledge, parsing C++ grammar is tooooo complex. :(

BTW: it seems the C++ 0x add many new C++ grammars, so our cc's heuristic parser should adjust a lot...
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

ollydbg

If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.