Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » standalone parser and generator
standalone parser and generator [message #699778] Fri, 22 July 2011 09:41 Go to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Hello,
I have a maybe naive question, but I cannot find a clear answer.

Can I use Xtext to output the parser and the code generator for my grammar as a standalone software, which can be run without eclipse?
Let's say I'd like to get a .jar and give it to a friend, so that after writing his model file (with a plain text editor) he can just use java to parse the text (to check for errors) and generate code out of it.

I found similar questions on the forum, and in the FAQ, but it seems they are concerned about manipulating the model with a custom java program (please correct me if I am wrong), which is not what I want to do.

Thanks a lot
B
Re: standalone parser and generator [message #699790 is a reply to message #699778] Fri, 22 July 2011 10:07 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

why shouldn't this work

In Xtext next to Generator there is a Workflow (and in Xtext 2.0 a Main class) that exactly does this)

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: standalone parser and generator [message #699811 is a reply to message #699790] Fri, 22 July 2011 11:11 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Yes, fine.
But I need to run the same stuff outside Eclipse, as a standalone, plain java app.
I found some useful instructions here:
http://zarnekow.blogspot.com/2010/06/how-to-deploy-xtext-standalone.html

(which however does not work.. comments say you need to provide a wrapper main class)

thank you
Re: standalone parser and generator [message #699814 is a reply to message #699811] Fri, 22 July 2011 11:15 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

is standalone not what we talked about the whole thread?

The Main Class is a class Wink
There are runners for Workflows Wink

which xtext version do you use?
never the less what sebastian described in his blog should still work.

Did you have a look at the link Karsten provided in Sebastian Blog:
http://code.google.com/a/eclipselabs.org/p/lwc11-xtext/wiki/Phase_3_HeadlessGenerator

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 22 July 2011 11:16]

Report message to a moderator

Re: standalone parser and generator [message #699822 is a reply to message #699814] Fri, 22 July 2011 11:41 Go to previous messageGo to next message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Quote:

The Main Class is a class Wink

Yes, agree, but I do not have it. I am not using Xtext 2.0
Quote:

There are runners for Workflows Wink

I did not even know this at the beginning; then, I had no idea of where they were, how could I use them without relying on Eclipse..

Quote:

which xtext version do you use?
never the less what sebastian described in his blog should still work.

Did you have a look at the link Karsten provided in Sebastian Blog:
http://code.google.com/a/eclipselabs.org/p/lwc11-xtext/wiki/Phase_3_HeadlessGenerator


I think I am using version 1.0.2.
The link of Karsten seems not working.
The blog of Sebastian shows how to actually invoke the runner from command line, packaging all the required stuff in a jar. That is exactly what I was thinking about.
(But as said, there is a problem, it does not find the main class (see comments))

Anyway..
Thanks for your patience
B
Re: standalone parser and generator [message #699827 is a reply to message #699822] Fri, 22 July 2011 12:00 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

Karsten updated his stuff to Xtext 2.0
Never the less a Wrapper (Delegate) arround org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher should be a notbrainer

public class MyMwe2Launcher {
	
	public static void main(String[] args) {
		Mwe2Launcher.main(args);
	}

}


~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Fri, 22 July 2011 12:04]

Report message to a moderator

Re: standalone parser and generator [message #699888 is a reply to message #699811] Fri, 22 July 2011 14:28 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Bruce,

What specifically isn't working? Unless you provide details, no one
will be able to provide the information you need...


On 22/07/2011 4:11 AM, Bruce wrote:
> Yes, fine.
> But I need to run the same stuff outside Eclipse, as a standalone,
> plain java app.
> I found some useful instructions here:
> http://zarnekow.blogspot.com/2010/06/how-to-deploy-xtext-standalone.html
>
> (which however does not work.. comments say you need to provide a
> wrapper main class)
>
> thank you


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: standalone parser and generator [message #699920 is a reply to message #699888] Fri, 22 July 2011 15:16 Go to previous message
Bruce L. is currently offline Bruce L.Friend
Messages: 81
Registered: June 2011
Member
Ed,
the "export as executable jar" (see the blog of Sebastian) is not working properly, it complains that it cannot find a class with the main() method.

But the "wrapper" class

Quote:

Never the less a Wrapper (Delegate) around org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher should be a notbrainer

public class MyMwe2Launcher {

public static void main(String[] args) {
Mwe2Launcher.main(args);
}

}


is very easy and does the trick. You need to select it when creating the run configuration that you then apply to the exported jar.
Thanks Christian
Previous Topic:[Xtext2/Xbase] Constructors for Entities in DomainModel example are not working
Next Topic:[Xtext] Multiple objects in one line
Goto Forum:
  


Current Time: Thu Mar 28 21:36:48 GMT 2024

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

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

Back to the top