Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext grammar to Java Code Generation(I write the grammar and also tested it. Now, I want to generate a java code from the grammar. I followed the documentation but things are very complicated.)
Xtext grammar to Java Code Generation [message #1823565] Sun, 29 March 2020 04:32 Go to next message
Muhammad Salman Tayyab is currently offline Muhammad Salman TayyabFriend
Messages: 26
Registered: March 2020
Location: Germany
Junior Member
This is my Grammar:
name=ID "=" STRING ";";

and I want to generate a code based on the grammar that a string value is assigned to the variable. I just want to generate this code. Please guide me how can I do it. I am confused about what to write in the dslGenerator.xtend file.

Re: Xtext grammar to Java Code Generation [message #1823725 is a reply to message #1823565] Tue, 31 March 2020 18:59 Go to previous message
Karsten Thoms is currently offline Karsten ThomsFriend
Messages: 742
Registered: July 2009
Location: Dortmund, Germany
Senior Member

The project creates a generator stub for you. Check the [YourDsl]Generator class as an entry point.
You can install one of the examples with File/New/Example. Maybe the Statemachine example is the best to start for you.
Also a valuable resource is Lorenzo Bettini's book on Xtext.
Previous Topic:Terminal with specific size
Next Topic:Grammar support
Goto Forum:

Current Time: Tue Jan 19 19:58:58 GMT 2021

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

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

Back to the top