Kdevelop, php, duchain and stuff :)

Milian Wolff mail at milianw.de
Mon Feb 1 08:31:17 UTC 2010


Victor Vicente de Carvalho, 01.02.2010:
> Hi Milian,

Hi Victor! I'm CC'ing the KDevelop ML, please reply there and send future 
mails there first. The other developers could potentially answer your questions 
as well. Please sign up there, it will be of great help if you want to start 
on development of KDevelop.

> It's been a while that I'm a silent reader on kdevelop discussion mails,
> and studying a little I've found Kdevelop very well designed, so I'm here
> trying to build myself an plugin for Erlang :), and started by studying
> the php plugin as warmup, and by that some questions have already popped
> out. So, as your mail is there as maintainer... Could you lend a hand to a
> fellow programmer?

Sure, I'll try to help as good as I can. Also note that Niko is just as much 
Maintainer as me, maybe even more so as he was the one who started all this.

> I'm focusing on the parser first:

Imo a good choice to start there. You won't see much results first though, it 
takes some time - just so you be warned ;-)

> 1 - There are some pregenerated code related to the PHP AST tree. How that
> is generated? I haven't found the generator on the code.

You'll find a php.g in parser/ dir. That is the grammar from which the parser 
generator KDevelop-PG-Qt (you can find it in Playground) generates the files. 
Also see this as docu:
http://techbase.kde.org/Development/KDevelop-PG-Qt_Introduction

> 2 - How the parser is integrated with the DUChain? There is documentation
> around it?
> 3 - Code parsing is a external process? How it is integrated with Kdevelop?

There are some bits and pieces in the API documentation (dunno whether we have 
a HTML version of that somewhere, if not you can probably do it yourself with 
doxygen). Other than that the structure is basically:

- KDevelop loads language support plugin (lsp)
- lsp is asked to generate a parsejob for files it says it supports (see 
mimetype in .desktop file)
- parse job starts:

1) a parse-session that creates an AST from the contents of a given document
2) runs a DUChainBuilder on the AST. The DUChainBuilder is in itself a nested 
Builder (via inheritance) that does the following (from top to bottom):
2a) create Declaration where appropriate (DeclarationBulider)
2b) associate a Type with the Declaration (TypeBuilder)
2c) create/associate DUContexts with the Declarations or areas of the Document 
(ContextBuilder)
3) runs a UseBuilder on the AST and the created TopDUContext and it's 
Declarations.

> Sorry for the inconvenience, If you think this is not the proper channel,
> could you direct me for the right one?

As I said above, use the developer ML of KDevelop in future.

Have a nice day, cya around
-- 
Milian Wolff
mail at milianw.de
http://milianw.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop-devel/attachments/20100201/546d3b4a/attachment.sig>


More information about the KDevelop-devel mailing list