Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Call-hierarchy support
Call-hierarchy support [message #1194402] Mon, 18 November 2013 13:46 Go to next message
Siber Just Siber is currently offline Siber Just SiberFriend
Messages: 6
Registered: October 2013
Junior Member
Hi everyone,

I want to add call-hierarchy feature support to my IDE for a C-like DSL. After some googling I found that it should be possible by means of Xbase, but I still have a question:

if my language allows functions to be declared and defined outside any class (just like in C), will Xbase approach still do or should I choose another approach?

Thanks in advance!
Re: Call-hierarchy support [message #1197620 is a reply to message #1194402] Wed, 20 November 2013 00:54 Go to previous message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member

I'm not the biggest expert around here, but here's what I can tell you.
If you need direct interoperability with Java code from your DSL (e.g. call java methods, use java types...), then there's really no practical chance to avoid Xbase. Also, Xbase mainly concerns itself with expressions, not syntactic structures like classes (so there should not be a substantial difficulty in using an Xbase expression without a class or method structure surrounding it, as long as you can map it to a valid java class). I once had a DSL project which allowed to build class-like structures, and when it came to methods, it employed the XExpression offered by Xbase. However, you have to "buy a pig in a poke" here: as soon as you use Xbase, you will have to provide a JVMModelInferrer for everything in your DSL, which can either be very tricky or extremely simple, depending on what you want to do. If all else fails, you can also customize Xbase expressions (there are actually a few threads about that around here right now), but I'd not recommend to do that unless you really need to do it.

If you do not need Java interoperability directly from your DSL, then there's always the option to write a custom expression DSL. You'll have to deal with the recursive nature of expressions and Xtexts/ANTLRs aversion against left recursions (refer to Sven's Blog for details) and you'll also have to roll your own type system and scoping.

Regarding Call Hierarchies: I've never actually needed that particular feature and I'm not sure if Xbase supports this (as stated above, it concerns itself primarily with Expressions, not methods). If you roll your own expression DSL, then this will definitly not be supported out of the box (a method and a "call" are domain specific features of your DSL, not general concepts). In this case you will most likely have to look into the Eclipse API of this feature yourself and implement it based on the "raw" Eclipse API without Xtext in between.

There's also an example/tutorial on an Xtext-based Scripting language on the official Xtext Homepage, maybe that will help you to get on track.

Hope this helps,


[Updated on: Wed, 20 November 2013 00:56]

Report message to a moderator

Previous Topic:Customize "hover-support" for non-grammer EObjects
Next Topic:Multiple Outline Views
Goto Forum:

Current Time: Tue Jan 19 12:47:31 GMT 2021

Powered by FUDForum. Page generated in 0.01831 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top