FORTRAN language plugin

Milian Wolff mail at milianw.de
Tue Jan 25 18:14:54 GMT 2011


Daniel Pena, 25.01.2011:
> Milian Wolff <mail at ...> writes:
> > On Tuesday 12 October 2010 00:07:42 ulissebionda wrote:
> > >   How about a FORTRAN 90/95 plugin in Kdevelop 4?
> > > 
> > > alangea
> > 
> > Hey there,
> > 
> > someone has to step up to write a language support plugin for this
> > language. Until then, nothing will happen in this regard I'm afraid to
> > say.
> > 
> > Maybe you can help? Just a bit of C++/Qt knowledge is required (one could
> > learn it) and we would help you out with the plugin. I did the same for
> > the PHP plugin back then and now I'm one of the core contributors of
> > KDevelop :)
> > 
> > Bye
> 
> Hi
> 
> I would be very much interested in such a plugin. Also, I would be able to
> contribute to the effort or at least bootstrap it.
> 
> Only thing is, I was unable to find any docs or tutorials on how to write
> (or at least start) plugins for kdevelop 4. Is there a place where one can
> find that kind of info?

Hey there (also to Micheal):

First up, it's sad reality that we lack any kinds of tutorials on how to get 
started with a language plugin. But I can at least tell you the rough stuff 
you need to do:

- implement ILanguageSupport
- implement a KDevelop::ParseJob for your language

in that parsejob now, you need - roughly - three things:

a) given source code, build an AST
b) given AST build DUChain Items (Context, Declarations, Types, Uses)
c) highlight code

The former takes some time, depending on the language. C++ has "forked" a 
generated parser and is now hand-written. PHP's parser is generated, the lexer 
is hand written. Python uses Python to generate the AST, Ruby uses some 
QRegExp for slow'n'dirty support of some features.

Anyways, as you can see this is the first step you need to take for *proper* 
language support. If you want to write your own parser, take a look at 
KDevelop-PG-Qt, though any other parser generator could be used.

Once you have this done, you'll need to implement AbstractDeclarationBuilder, 
AbstractContextBuilder and AbstractTypeBuilder as well as AbstractUseBuilder. 
You might also need to create custom DUChain items if those existing in 
KDevplatform do not suffice.

In these builders, which are more or less just visitors of an AST, you do the 
semantic analysis (as far as possible in your language):

- build contexts (classes, functions, namespaces, ...)
- declare variables, classes, functions, namespaces, ...
- assign types (int, bool, custom types, ...) to these variables

That's basically it. But trust me, it takes quite some time to get a good 
language plugin. Anyways, for most a proper AST generator would help, the rest 
is - once you understood the DUChain - "just writing code".

Bye

-- 
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: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kdevelop/attachments/20110125/528e938b/attachment.sig>


More information about the KDevelop mailing list