Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Using xtext without eclipse
Using xtext without eclipse [message #831084] Wed, 28 March 2012 08:56 Go to next message
Eclipse UserFriend
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 09:31 Go to previous messageGo to next message
Eclipse UserFriend
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 09:52 Go to previous messageGo to next message
Eclipse UserFriend
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 13:03 Go to previous message
Eclipse UserFriend
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
Previous Topic:Exception when serializing
Next Topic:Use Xtext infrastructure in standalone application
Goto Forum:
  


Current Time: Mon Jul 07 15:18:09 EDT 2025

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

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

Back to the top