Check Validity of automatically generated instances [message #1852196] |
Wed, 04 May 2022 10:31  |
Eclipse User |
|
|
|
Hello,
I am young user of xtext and I have some questions about its usage. I defined a grammar, and I try to generate automatically some instances of the grammar but there are no guaranties about the validity of the instances. The automatic generation is done by changing a few tokens (mutation). I am unsure that these local changes do not break my grammar rules. I am wondering if there is a function that can validate the instance automatically.
I have tried to use the "ParseHelper" class but I cannot use it out of the test project.
Thanks in advance
Antoine
|
|
|
|
|
Re: Check Validity of automatically generated instances [message #1852229 is a reply to message #1852201] |
Thu, 05 May 2022 09:20   |
Eclipse User |
|
|
|
Hello,
Thanks for your answers.
Sorry for not being precise enough. I will reexplain and I attach an image.
I have two scenarios:
First, I have defined a grammar and I can generate automatically instances. I am currently using the factory class created by xtext and modified the body of the methods according to my grammar rules. This can give me N instances from the grammar, but how can I be sure that they are correct w.r.t. the grammar rules? That is the top part of the image.
Second, I select one of the generated instances and I modify it automatically (by changing some of the tokens, i.e., what we call mutation). I want to know whether this new modified instance is valid w.r.t. the grammar. This is the bottom part of the image.
For instance, you can see that the modification inserted "pooling" token after the "conv" one. It is supposedly valid, but I would like to check it with the grammar rules. Is that possible?
I hope it is clearer now.
Thanks.
Antoine
[Updated on: Thu, 05 May 2022 09:20] by Moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03173 seconds