Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to invoke Xtext parser/JvmModelInferrer from a Java project
How to invoke Xtext parser/JvmModelInferrer from a Java project [message #893684] Thu, 05 July 2012 09:15 Go to next message
Marcus Mathioudakis is currently offline Marcus Mathioudakis
Messages: 18
Registered: June 2012
Junior Member
I have implemented a simple little DSL that generates classes from input files, by using the JvmModelInferrer approach. I am trying to figure out how I can invoke the parser and the code genarator within the code of a regular java project. So at some point in the main class of my non-Xtext project I can just create a file, pass it to the Xtext parser/codeGenerator for my DSL, and the result will be that class files are generated to a folder of my choice (within my java project).
This case is not covered in the documentation, so any help would be much appreciated, Thanks!
Re: How to invoke Xtext parser/JvmModelInferrer from a Java project [message #893979 is a reply to message #893684] Fri, 06 July 2012 09:46 Go to previous message
Lorenzo Bettini is currently offline Lorenzo Bettini
Messages: 1368
Registered: July 2009
Senior Member
On 07/05/2012 11:15 AM, Marcus Mathioudakis wrote:
> I have implemented a simple little DSL that generates classes from input
> files, by using the JvmModelInferrer approach. I am trying to figure out
> how I can invoke the parser and the code genarator within the code of a
> regular java project. So at some point in the main class of my non-Xtext
> project I can just create a file, pass it to the Xtext
> parser/codeGenerator for my DSL, and the result will be that class files
> are generated to a folder of my choice (within my java project).
> This case is not covered in the documentation, so any help would be much
> appreciated, Thanks!

Hi

I don't know whether this might solve your problem, but if in your
workflow you enable this fragment

// generator API
fragment = generator.GeneratorFragment {
generateJavaMain = true
}

you will find a Main.java generated class that implements the command
line compiler... I think you might get inspiration from that class...

hope this helps
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
ICQ# lbetto, 16080134 (GNU/Linux User # 158233)
HOME: http://www.lorenzobettini.it MUSIC: http://www.purplesucker.com
http://www.myspace.com/supertrouperabba
BLOGS: http://tronprog.blogspot.com http://longlivemusic.blogspot.com
http://www.gnu.org/software/src-highlite
http://www.gnu.org/software/gengetopt
http://www.gnu.org/software/gengen http://doublecpp.sourceforge.net
Previous Topic:Newbie question on round tripping
Next Topic:How to create Editors for sychronize GMF and Xtext
Goto Forum:
  


Current Time: Tue Oct 21 10:25:55 GMT 2014

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

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