Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » how to automatically compile my . java from src-gen??
how to automatically compile my . java from src-gen?? [message #1051022] Sun, 28 April 2013 00:42 Go to next message
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 24
Registered: February 2013
Junior Member


sorry for my english, but I do not quite understand Xbase Interpreter, quickly need at least eclipse directly compile the *. java created in the console to see the result of at least one System.out.printl ("Hello world").

My language definition only have one Statemment, printl

thank you very much
Re: how to automatically compile my . java from src-gen?? [message #1051522 is a reply to message #1051022] Sun, 28 April 2013 19:19 Go to previous message
Yoandri Saavedra is currently offline Yoandri Saavedra
Messages: 24
Registered: February 2013
Junior Member

Look my .xtext file...

grammar something with org.eclipse.xtext.xbase.Xbase

generate milenguaje "something"

Inicio:
	'paquete' nombre=QualifiedName
	(inicio+=Escribir)*
;
Escribir:
	'escribir' contenido=STRING ';' 
;



truth, is in spanish, and my generator is
override void doGenerate(Resource resource, IFileSystemAccess fsa) {
		for(e: resource.allContents.toIterable.filter(typeof(Inicio))){
			fsa.generateFile(
				e.nombre.toString() +".java",
				e.compile
			)
		}
	}
	def CharSequence compile(Inicio inicio)'''
		import java.io.* ;
		public class «inicio.nombre» {
			public static void main(String[] args){
			«FOR i:inicio.inicio»
				«i.compile»
			«ENDFOR»
			}
		}
	'''
	def compile(Escribir escribir)'''
			System.out.println ("«escribir.contenido»") ;
	'''	

And work fine, but, only need when my user type
escribir "Hola mundo!!";
XBase evaluate this as System.out.println("Hola mundo") and look in console "Hola mundo!!!", in Xtext documentation I no found nothing with Sistem.out ou Sistem.in, and this is very important to any interpreter. Thank very much and I'm sorry for my problem in english language.
Previous Topic:Selection Listener
Next Topic:message console and terminate button
Goto Forum:
  


Current Time: Tue Sep 02 12:54:37 EDT 2014

Powered by FUDForum. Page generated in 0.03141 seconds