Registered Member
|
Is there an example somewhere for a simple semantic analysis plugin?
I have a language with fairly simple syntax, and I'd like to be able to jump from references to declarations and vice versa. For example:
In this example, instance #23 references #21, and #21 references #20. Using grep, I can find all declarations with
and all references with
How hard would it be do write a plugin that does this? |
Global Moderator
|
Writing language plugins for KDevelop is never trivial, as the interface is meant to be powerful and complete, not simple (i.e. it's not designed to be used in lots of 5-line language plugins). For what you proposed it shouldn't be that difficult, but you'll neverthereless need a few days at the very least to get the idea of the language plugin architecture. We're happy to help you out in our IRC channel tough, in case you have specific questions.
You could probably just take e.g. the PHP plugin, delete most code except for the parse job and the plugin trivia, change the parse job to do some regex matching and pack that into a very simple AST, and implement one function in each declaration and use builder which creates declarations / uses for those variables you have there. Stuff like highlighting and tooltips will then be (almost) available "for free". Greetins, Sven
I'm working on the KDevelop IDE.
|
Registered Member
|
It's too bad that there isn't a minimal example that does something really simple.
Where is this code? I took a look at the git repos for kdevplatform and kdevelop, and nothing stood out. Thanks Mark |
Global Moderator
|
Yes, there's planning going on for a minimal example plugin. But nobody yet had the time to write it.
PHP and Python are seperate plugins in their own repositories, they're at git://anongit.kde.org/kdev-php.git or kdev-python.git.
I'm working on the KDevelop IDE.
|
Registered users: Bing [Bot], claydoh, Google [Bot], rblackwell