Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » DSLs targetting non-Java languages
DSLs targetting non-Java languages [message #1033417] Thu, 04 April 2013 04:03 Go to next message
Jesper Eskilson is currently offline Jesper Eskilson
Messages: 131
Registered: July 2009
Senior Member
Hello,

Are there any Xtext-based DSLs (tutorials, examples, etc.) which cover targeting non-Java environments? I have a DSL which needs to translated to code which is to run in a C/C++ application with no JVM present, and I was hoping to avoid having to embed a JVM.

The DSL typically looks like this:

entity MyEntity {
    name SomeName
    handler {
        <insert some code here>
    }
}


I've been looking at using Xbase, but it seems very heavily tied to JVM execution, and I'm not sure how much work it would be to get it to generate C/C++ code instead.

Worst case I can embed C/C++ code inside a string, but if there is a more elegant solution which allows the user to leverage Xtext features in the embedded code, it would be very nice.

Any ideas?
Re: DSLs targetting non-Java languages [message #1033433 is a reply to message #1033417] Thu, 04 April 2013 04:11 Go to previous message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Am 04.04.13 10:03, schrieb Jesper Eskilson:
> Hello,
>
> Are there any Xtext-based DSLs (tutorials, examples, etc.) which cover
> targeting non-Java environments? I have a DSL which needs to translated
> to code which is to run in a C/C++ application with no JVM present, and
> I was hoping to avoid having to embed a JVM.
>
> The DSL typically looks like this:
>
>
> entity MyEntity {
> name SomeName
> handler {
> <insert some code here>
> }
> }
>
>
> I've been looking at using Xbase, but it seems very heavily tied to JVM
> execution, and I'm not sure how much work it would be to get it to
> generate C/C++ code instead.
>
> Worst case I can embed C/C++ code inside a string, but if there is a
> more elegant solution which allows the user to leverage Xtext features
> in the embedded code, it would be very nice.
>
> Any ideas?

You can always use Xtext without Xbase and implement the expressions
manually. That's actually a very common usecase. The docs are pretty
clear about the cases where Xbase is applicable. Also, Jan wrote a blog
on that topic recently:
http://koehnlein.blogspot.de/2013/04/x-is-for-abstraction.html

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:How to insert non-existing fields into the scope
Next Topic:Xtext: Trying to check for cross references but get ambiguous grammar
Goto Forum:
  


Current Time: Thu Jul 31 01:37:11 EDT 2014

Powered by FUDForum. Page generated in 0.01853 seconds