Home » Modeling » TMF (Xtext) » [XText] newbie question: Can XText generate code.
|
Re: [XText] newbie question: Can XText generate code. [message #45998 is a reply to message #45850] |
Fri, 29 May 2009 05:42 |
Sebastian Zarnekow Messages: 3118 Registered: July 2009 |
Senior Member |
|
|
Hi Michael,
Xtext is a framework that helps you to create textual domain specific
languages and appropriate tooling for them. Keeping that in mind, I
won't say Xtext is a classic code generator. But you may use it to store
a semantic model in a concrete textual syntax (generate something). With
the help of the generated parser, these text files can be loaded back
into memory. During the loading process Xtext will recreate your
semantic model.
That said, you can do some kind of roundtrip engineering with Xtext:
Text -[parsing/loading]->
Model -[in memory modification aka transformation, refactoring ..]->
Model -[serialization]->
Text ...
Doesn't look like the classic code generator usecase, does it?
Please describe in a few words what you are trying to achieve.
Regards,
Sebastian
Am 28.05.2009 15:55 Uhr, schrieb Michael:
> Hi,
> I am a newbie of XText. So far, I have known that XText can be used to
> generate parsers and language editors. However I am wondering whether
> XText can be used to
> generate code, and how. In fact, I did not find any Java class is
> intended for generating code in a built-in example XText project. Hints
> are welcome.
> Thanks.
> Regards
> Michael
|
|
| | | | |
Re: [XText] newbie question: Can XText generate code. [message #47213 is a reply to message #47068] |
Tue, 02 June 2009 14:24 |
Eclipse User |
|
|
|
Originally posted by: sderrienREMOVE.irisa.fr
Hi,
Just a very naive question : how difficult would it be to automatically
generate a xpand template that would map a model onto a textual
representation generated according to the xtext grammar (a kind of
source to source workflow)?
Steven
Sven Efftinge a écrit :
> Hi Steffen,
>
> sure, I just wanted to clarify in order to avoid confusing other people,
> who don't have the oAW background but are looking at the stuff from the
> Eclipse-point of view, where the components live in different projects.
>
> Cheers,
> Sven
>
> Steffen Stundzig schrieb:
>> Sven Efftinge wrote:
>>
>>> The code generation technology is called Xpand (M2T Xpand).
>>> MWE is just a tool to orchestrate and configure things like code
>>> generators, model parsers and model transformations.
>>
>> thx for the clarification again. In my simple _obsolete_ world, there
>> exists only the two components xtext and oaw in mind. ;)
>>
>> regards
>> Steffen...
>>
|
|
|
Re: [XText] newbie question: Can XText generate code. [message #47289 is a reply to message #47213] |
Tue, 02 June 2009 18:25 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
Hi Steven,
I'm not sure what you mean but if you're talking of serializing a parsed
model back to its textual representation, I can say that it's hard
generate such a serializer from a grammar.
I know this because we've had (actually Moritz Eysholdt had) hard time
to solve this. But it is solved and with TMF Xtext you get this
serialization mechanism generated for your grammar. :-)
But I bet you knew that already and I completely missed the point...
Cheers,
Sven
Steven Derrien schrieb:
> Hi,
>
> Just a very naive question : how difficult would it be to automatically
> generate a xpand template that would map a model onto a textual
> representation generated according to the xtext grammar (a kind of
> source to source workflow)?
>
> Steven
>
> Sven Efftinge a écrit :
>> Hi Steffen,
>>
>> sure, I just wanted to clarify in order to avoid confusing other
>> people, who don't have the oAW background but are looking at the stuff
>> from the Eclipse-point of view, where the components live in different
>> projects.
>>
>> Cheers,
>> Sven
>>
>> Steffen Stundzig schrieb:
>>> Sven Efftinge wrote:
>>>
>>>> The code generation technology is called Xpand (M2T Xpand).
>>>> MWE is just a tool to orchestrate and configure things like code
>>>> generators, model parsers and model transformations.
>>>
>>> thx for the clarification again. In my simple _obsolete_ world, there
>>> exists only the two components xtext and oaw in mind. ;)
>>>
>>> regards
>>> Steffen...
>>>
|
|
|
Re: [XText] newbie question: Can XText generate code. [message #47363 is a reply to message #47289] |
Tue, 02 June 2009 21:00 |
Eclipse User |
|
|
|
Originally posted by: sderrienREMOVE.irisa.fr
Hi,
Sven Efftinge a écrit :
>
> Hi Steven,
>
> I'm not sure what you mean but if you're talking of serializing a parsed
> model back to its textual representation, I can say that it's hard
> generate such a serializer from a grammar.
> I know this because we've had (actually Moritz Eysholdt had) hard time
> to solve this. But it is solved and with TMF Xtext you get this
> serialization mechanism generated for your grammar. :-)
>
> But I bet you knew that already and I completely missed the point...
No you did not, I didn't know that this feature was available in xtext.
Is it documented somewhre, are there some examples ?
It seems that it's me who completely missed the point ...
Steven
>
> Cheers,
> Sven
>
> Steven Derrien schrieb:
>> Hi,
>>
>> Just a very naive question : how difficult would it be to
>> automatically generate a xpand template that would map a model onto a
>> textual representation generated according to the xtext grammar (a
>> kind of source to source workflow)?
>>
>> Steven
>>
>> Sven Efftinge a écrit :
>>> Hi Steffen,
>>>
>>> sure, I just wanted to clarify in order to avoid confusing other
>>> people, who don't have the oAW background but are looking at the
>>> stuff from the Eclipse-point of view, where the components live in
>>> different projects.
>>>
>>> Cheers,
>>> Sven
>>>
>>> Steffen Stundzig schrieb:
>>>> Sven Efftinge wrote:
>>>>
>>>>> The code generation technology is called Xpand (M2T Xpand).
>>>>> MWE is just a tool to orchestrate and configure things like code
>>>>> generators, model parsers and model transformations.
>>>>
>>>> thx for the clarification again. In my simple _obsolete_ world,
>>>> there exists only the two components xtext and oaw in mind. ;)
>>>>
>>>> regards
>>>> Steffen...
>>>>
|
|
| |
Goto Forum:
Current Time: Wed Jan 15 11:51:12 GMT 2025
Powered by FUDForum. Page generated in 0.02799 seconds
|