|
|
|
|
Re: Create intermediate EMF model for additional Validation and for Code generation [message #1777081 is a reply to message #1776956] |
Fri, 24 November 2017 10:43 |
Chris X Messages: 60 Registered: November 2017 |
Member |
|
|
Maybe an example to make it more clear:
for(var i = 1; i < 4; i++){
results ID{
... some code ...
}
}
description "In this string I can refer to <<results1>>, <<result2>> and <<result3>>"
In my DSL it should be possible to create a result with an ID and with a loop it should be possible to create some results.
After the loop it should be possible to refer to these three results.
My idea was to generate an intermediate EMF-Model which contains i.a. all results and finally represents a report.
In the dsl it should be possible to refer to the elements of the intermediate EMF-Model (Representation of the report) that is generated from the DSL during runtime.
But to refer to all results of the loop I have to resolve the loop to:
result res_1{
....
}
....
result res_3{
....
}
Currently I have two main questions:
1) What is the best way to provide dynamic IDs for the results?
2) And the most important question, what is the best way to create such an intermediate emf-model?
If it's a total stupid idea, what would be a good alternative?
I would be so happy for some hints/starting points.
I'm a xtext beginner and currently I have no clue:D
Many thanks :)
[Updated on: Thu, 30 November 2017 10:58] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Create intermediate EMF model for additional Validation and for Code generation [message #1777652 is a reply to message #1777586] |
Fri, 01 December 2017 09:35 |
Chris X Messages: 60 Registered: November 2017 |
Member |
|
|
Hi Christian,
enclosed a small HelloWorld example.
For the DSL you can use the following example code
report XY1{
result A{
}
for(1..4){
result B{
}
for(1..3){
result C{
}
}
}
result D{
}
// Now it should be possible to refer to results of the resolved for loop (from the intermediate model)
// for instance var test = B_1
}
Currently I generate the intermediate Model in the DerivedStateComputer. But so far it's not possible to refer to it (What is missing?). I'm aware that the idea of the IDerivedStateComputer is to manipulate the existing AST but at the end I need a new intermediate Model (intermediate AST) to do further validations. Maybe the IDerivedStateComputer is the wrong place to create such an intermediate Model. But so far I have no idea where I should start to generate this intermediate Model and what I have to do so that I can refer to it.
PS: For sure for this small example / DSL it would be sufficient to manipulate the existing AST in the IDerivedStateComputer
[Updated on: Fri, 01 December 2017 09:38] Report message to a moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.08282 seconds