|Re: Call-hierarchy support [message #1197620 is a reply to message #1194402]
||Wed, 20 November 2013 00:54
| Alan DW
Registered: March 2012
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
Powered by FUDForum
. Page generated in 0.01505 seconds