Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using xtext without eclipse
Using xtext without eclipse [message #831084] Wed, 28 March 2012 12:56 Go to next message
Alexander Savinov is currently offline Alexander SavinovFriend
Messages: 4
Registered: March 2012
Junior Member
What i want to do is using xtext with eclipse first, define a grammar and then let xtext create a parser. Than i want to invoke the parser from another program using java. Actually i just need to know if my defined rules conform to the defined grammar.

Thanks in advance.
Re: Using xtext without eclipse [message #831102 is a reply to message #831084] Wed, 28 March 2012 13:31 Go to previous messageGo to next message
Michael Ernst is currently offline Michael ErnstFriend
Messages: 49
Registered: July 2010
Member
What do you mean with "my defined rules"?

Normally I would suggest to use the org.eclipse.xtext.xtend2.standalone jar to include it into your java project, start up your guice module, query the injection provider for the parser and parse it.
ParserRule parseRule = grammerAccess.getMyParseRule();
IParser parser = injector.getInstance( IParser.class );
IParseResult result = parser.parse( parseRule , new StringReader( stringToParse) )

If you want to parse a whole file, use the IResourceValidator.

Kind regards
Michael
Re: Using xtext without eclipse [message #831122 is a reply to message #831102] Wed, 28 March 2012 13:52 Go to previous messageGo to next message
Alexander Savinov is currently offline Alexander SavinovFriend
Messages: 4
Registered: March 2012
Junior Member
Well you can call them as you wish in the end its just a line of text which should conform to the defined grammar. I just called them rules because they are mathematical rules.

Ok thanks for the info, i will try it.
Re: Using xtext without eclipse [message #831244 is a reply to message #831122] Wed, 28 March 2012 17:03 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

another possibility is to use std means as described here http://www.eclipse.org/forums/index.php/mv/msg/200108/638596/#msg_638596

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Exception when serializing
Next Topic:Use Xtext infrastructure in standalone application
Goto Forum:
  


Current Time: Wed Apr 24 23:05:05 GMT 2024

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

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

Back to the top