Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with XSemantics in Xtext(do not know how to test the XSemantics rules)
Problems with XSemantics in Xtext [message #1723306] Sun, 14 February 2016 01:58 Go to next message
Han Li Koay is currently offline Han Li KoayFriend
Messages: 25
Registered: February 2016
Junior Member
Hi, I am a newbie in Xtext. My school assignment requires me to create a simple DSL with if else statement and some expressions. So, my grammar needs some type checking.

I came across with XSemantics and started to use it by referring to the documentation and examples written by Lorenzo Bettini. There is one example "An Expression Language" from his documentation fits my requirement perfectly. However, i did not know how to test the code written in XSemantics. Because nothing changes even if i run it as a new Eclipse application like how i test my grammar in Xtext.

Is there any necessary steps to be done except writing the judgement rules? I really really need some guidance on this! Any help would be appreciated! Smile
Re: Problems with XSemantics in Xtext [message #1723319 is a reply to message #1723306] Sun, 14 February 2016 06:43 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi did you Tell xsemantics to hook into the generator using the validatorextends clause and having at least one check rule?


https://github.com/LorenzoBettini/xsemantics/blob/master/examples/it.xsemantics.example.expressions/src/it/xsemantics/example/expressions/typing/expressions-first.xsemantics


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with XSemantics in Xtext [message #1723320 is a reply to message #1723319] Sun, 14 February 2016 08:43 Go to previous messageGo to next message
Han Li Koay is currently offline Han Li KoayFriend
Messages: 25
Registered: February 2016
Junior Member
Hi Christian, it works perfectly now! It seems that my validatorExtends clause is not properly used. Thanks a lot for the help! Very Happy
Re: Problems with XSemantics in Xtext [message #1723333 is a reply to message #1723320] Sun, 14 February 2016 15:24 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 14/02/2016 09:43, Han Li Koay wrote:
> Hi Christian, it works perfectly now! It seems that my validatorExtends
> clause is not properly used. Thanks a lot for the help! :d

Hi Han

Xsemantics' documentation explicitly mentions how to use the type system
generated code in your DSL, by modifying your validator and by using
validatorExtends :)

http://xsemantics.sourceforge.net/xsemantics-documentation/XsemanticsSyntax.html#GeneratedValidator

hope you enjoy Xsemantics ;)

cheers
Lorenzo

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: Problems with XSemantics in Xtext [message #1723435 is a reply to message #1723333] Mon, 15 February 2016 16:22 Go to previous messageGo to next message
Han Li Koay is currently offline Han Li KoayFriend
Messages: 25
Registered: February 2016
Junior Member
Hi Lorenzo,

Another quick question, Is there any definition for all the judgement and relation symbols to guide me on how to use them?

Thanks
Re: Problems with XSemantics in Xtext [message #1723547 is a reply to message #1723435] Tue, 16 February 2016 14:12 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1812
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 15/02/2016 17:22, Han Li Koay wrote:
> Hi Lorenzo,
>
> Another quick question, Is there any definition for all the judgement
> and relation symbols to guide me on how to use them?
>
> Thanks
>

Hi

currently the list of all the available judgment and relation symbols
are not available in the documentation. Please file an issue about that.

Please, remember that the symbols to use are only your own decision.

cheers
Lorenzo

--
Prof. Lorenzo Bettini, Computer Science, DISIA, Univ. Firenze
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:Xtend Specific Issue
Next Topic:JvmModelInferrer for CodeGeneration from existing model
Goto Forum:
  


Current Time: Thu Apr 25 16:52:11 GMT 2024

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

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

Back to the top