Running / Interpret the DSL [message #798439] |
Tue, 14 February 2012 17:48 |
Eclipse User |
|
|
|
[new to xtext - so please bare with me]
OK, so now I have a simple defined DSL with all the features that one can
expect from an IDE!
But how can I re-use this generated infrastructure to actually execute / run
/ interpret my langauge files?
Preferably I would like to be able to execute both from within Eclipse and
from a command line set-up.
Any hint trick suggestion greatly appreciated.
Peter
|
|
|
|
|
|
Re: Running / Interpret the DSL [message #798623 is a reply to message #798580] |
Tue, 14 February 2012 22:47 |
Henrik Lindberg Messages: 2509 Registered: July 2009 |
Senior Member |
|
|
I did exactly what you are after in the Eclipse b3 project - I
implemented running/interpreting in several different ways - running the
dirty state in the editor, running from dialogs/wizards (passing in
parameters), and much more.
There is a "run" menu extension IIRC in one of the ui components that
serves as an entry point into the functionality.
- henrik
On 2012-14-02 22:27, Peter S Eden wrote:
> Hi,
>
> Thanks for prompt reply.
>
> Here is want I want to achive:
> - when in Eclipse and working in the XText generated editor / environment :
> having the abilty to press a Run button to execute the code in the editor
> and to get the output in the Eclipse Console
> - when in command line mode (comamnd shell): enter java -cp mydsl.jar
> mydsl.dsl (where mydsl.dsl is a text file with my 'code'), output to stdout
>
> Pretty much like when you develop java code in Eclipse, you can run it
> directly in the IDE, but you can also run the code at command prompt.
>
> I would prefer it I can maintain the generated xtext plug-in structure and
> simply do a export of the jar file (to mydsl.jar in my sample above).
>
> Is it possible to achive this with xtext (run from Eclipse, run standalone
> with the same plug-ins)? If not how can I make it in another way?
>
> I did have a quick peek into the
> http://wiki.eclipse.org/Xtext/FAQ#How_do_I_load_my_model_in_a_standalone_Java_application.C2.A0.3F
> article and was
> a bit surprised that the model defintion must be loaded. I would have
> thought that all symbols etc where compiled into java code. - agian I'm new
> to xtext / antlr etc.
>
>
>
>
> //Peter
>
>
>
>
>
> "Christian Dietrich"<forums-noreply@eclipse.org> skrev i meddelandet
> news:jheaue$ts1$1@news.eclipse.org...
>> Hi,
>>
>> welcome to Xtext.
>> your question is very unspecific so it is hard to give an answer.
>> here are some options
>>
>> (1) you can call your processor when saving the model file e.g. using an
>> IXtextBuilderParticipant (2) you can call your processor explicitely e.g.
>> like it is done for this code generator
>> http://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/
>> (3) process your models standalone with a mwe2 workflow or via java app as
>> described here:
>> http://wiki.eclipse.org/Xtext/FAQ#How_do_I_load_my_model_in_a_standalone_Java_application.C2.A0.3F
>>
>> ~Christian
>
>
|
|
|
Re: Running / Interpret the DSL [message #799411 is a reply to message #798593] |
Wed, 15 February 2012 21:23 |
Eclipse User |
|
|
|
Hi,
I was just a bit confused, but now I realize that the model is actually the
file with my language statments inside.
Peter
"Christian Dietrich" <forums-noreply@eclipse.org> skrev i meddelandet
news:jhekv6$h8i$1@news.eclipse.org...
> Hi,
>
> it is a common pratice in eclipse to split between runtime/standalone and
> ui.
> never the less it should be no problem to achieve this.
>
> your point on the example from the wiki i do not understand.
> what do you mean with "model defintion must be loaded"
>
> ~Christian
|
|
|
Re: Running / Interpret the DSL [message #811351 is a reply to message #799411] |
Fri, 02 March 2012 08:24 |
Sergey K Messages: 2 Registered: March 2012 |
Junior Member |
|
|
Hi Peter
From your question:
>> Here is want I want to achive:
>> - when in Eclipse and working in the XText generated editor / environment :
>> having the abilty to press a Run button to execute the code in the editor
>> and to get the output in the Eclipse Console
Honestly, I didn't understand from this topic - is it possible or not ?
and if it is possible - how to do this?
PS I understand that I can add generated src-gen to project and execute generated java classes as usual. But these action will be executed by DSL end-developer, and it will be great to hide this routine from his.
End-developer who uses DSL hasn't care about java routine (I mean adding src-gen to his own project and execute generated java classes) - He should have deals just with DSL and can execute it.
Regards,
Sergey
[Updated on: Fri, 02 March 2012 08:33] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03443 seconds