Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Embedding DSL in Java
Embedding DSL in Java [message #1699918] Mon, 29 June 2015 09:35 Go to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hello everybody,

I have developed a DSL. Now I want to embed this DSL in java.
I am new in this concept (Embedding DSL in GPL or java).

Is it possible?
Can I write the code between java codes with my DSL keywords?

Best regards
Parisa
Re: Embedding DSL in Java [message #1700090 is a reply to message #1699918] Tue, 30 June 2015 06:10 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi,

To give a better explanation about what I want to do, it's better to say.
I want to have a DSL in which I have the ability of writing java code.
Re: Embedding DSL in Java [message #1700094 is a reply to message #1700090] Tue, 30 June 2015 06:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

so you want to have java like expression inside your dsl?

java: hard to do.
xbase; very easy to do.

have a look at the domain model example or at the seven languages examples (see docs)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Embedding DSL in Java [message #1700095 is a reply to message #1700094] Tue, 30 June 2015 06:36 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
you may have a look at https://github.com/LorenzoBettini/javamm as well

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Embedding DSL in Java [message #1700096 is a reply to message #1700095] Tue, 30 June 2015 06:44 Go to previous messageGo to next message
Puneet Patwari is currently offline Puneet PatwariFriend
Messages: 64
Registered: November 2014
Member
Hi Parisa

You can do it using Xbase grammar in your grammar. You can see the process in this link : http://stackoverflow.com/questions/12196448/how-to-include-java-code-block-in-xtext-dsl
Re: Embedding DSL in Java [message #1700142 is a reply to message #1700095] Tue, 30 June 2015 11:43 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 30/06/2015 08:36, Christian Dietrich wrote:
> you may have a look at https://github.com/LorenzoBettini/javamm as well

Thanks for mentioning that, Christian :)
In the near future, I'm planning to refactoring the plain expression
part to be reusable in other DSLs.

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: Embedding DSL in Java [message #1700327 is a reply to message #1700142] Wed, 01 July 2015 21:08 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi,
is it possible to embed the syntax of a DSL in GPL?
For example here I define a DSL with Xtext and embed this syntax in java.

Re: Embedding DSL in Java [message #1700337 is a reply to message #1700327] Thu, 02 July 2015 03:47 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
No

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Embedding DSL in Java [message #1700585 is a reply to message #1700337] Sat, 04 July 2015 07:17 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi Christian,

I have thought about it and I think if I embed a Java in DSL and use a reference to Java-Code. It can be vice versa, therefore I can have a Java Code which can refer to DSL-Code.

Actually the implementation must be done with two editors. It's only a solution but it's not a scientific solution.

Regards,
Parisa
Re: Embedding DSL in Java [message #1700586 is a reply to message #1700585] Sat, 04 July 2015 07:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
the go with xbase.

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Embedding DSL in Java [message #1701094 is a reply to message #1700586] Thu, 09 July 2015 09:20 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi Christian,

how can I call java content assistance/ auto completion in DSL text editor in runtime instance of eclipse. Now I have auto completion but I want to open Java auto completion. In which part of forum or in which internet link can I want something about "Call completion engine"?

I have searched a little but I didn't find any code to call it manually.

[Updated on: Thu, 09 July 2015 09:22]

Report message to a moderator

Re: Embedding DSL in Java [message #1701095 is a reply to message #1701094] Thu, 09 July 2015 09:27 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

i do not understand what you are talking about. please explain: what do you mean by java auto completion


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Embedding DSL in Java [message #1701270 is a reply to message #1701095] Fri, 10 July 2015 11:47 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
Hi,
I want to have auto completion in DSL editor when I write java code block. Something like this photo.
  • Attachment: 1.png
    (Size: 23.94KB, Downloaded 91 times)
Re: Embedding DSL in Java [message #1701271 is a reply to message #1701270] Fri, 10 July 2015 11:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Hi,

this works out of the box ?!?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Embedding DSL in Java [message #1701303 is a reply to message #1701271] Fri, 10 July 2015 17:32 Go to previous messageGo to next message
Parisa Moosavi is currently offline Parisa MoosaviFriend
Messages: 81
Registered: June 2015
Member
I made it in paint Smile but I want to develop somnething like this.
Re: Embedding DSL in Java [message #1701308 is a reply to message #1701303] Fri, 10 July 2015 18:40 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14669
Registered: July 2009
Senior Member
Have a look at the domainmodel example

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Match Until (not working)
Next Topic:How to approach a scope problem
Goto Forum:
  


Current Time: Sat Apr 27 00:21:13 GMT 2024

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

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

Back to the top