Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » YAML encoded DSL in xtext(YAML encoded DSL in xtext)
YAML encoded DSL in xtext [message #1805563] Wed, 17 April 2019 13:22 Go to next message
Felix B is currently offline Felix BFriend
Messages: 2
Registered: April 2019
Junior Member
Hi,

I'm trying to build a grammar for a DSL which is encoded in YAML.
I'm quite new to xtext, but I found several posts from a few years ago of people trying to achieve similar things, but they all went nowhere.
The home automation example helps regarding the white space awareness but I'm not sure if xtext is suited for my task.

Are there any working YAML like grammars out there? And is it even a good idea to use xtext for this task?

Any advice is appreciated, thanks!
Re: YAML encoded DSL in xtext [message #1805709 is a reply to message #1805563] Mon, 22 April 2019 12:53 Go to previous messageGo to next message
Brandon Lewis is currently offline Brandon LewisFriend
Messages: 268
Registered: May 2012
Senior Member
Xtext can and will work for you. I posted about a couple of years ago with the same question. The home automation example was a difficult example for me to learn from. As I recall, it makes use of XBase, and this as an introduction, it was quite advanced to learn from. Too advanced for my small brain at least.

I found YAML was a good way to "trick" users into accepting the DSL because you could always fallback on the statement "it's just YAML"..

In my work, once the basics were figured out, the next harder step was the formatter code. I believe the more specific your DSL, the harder the formatter is to use.

I've got a busy week here, so I'm not sure when I'll be able to post an example. The easiest way for me now is to start with a simple grammar and replace the '{' and '}' symbols with BEGIN and END synthetic being and end symbols as the first step to "YAMLizing" your grammar.
Re: YAML encoded DSL in xtext [message #1805977 is a reply to message #1805709] Mon, 29 April 2019 14:56 Go to previous messageGo to next message
Felix B is currently offline Felix BFriend
Messages: 2
Registered: April 2019
Junior Member
Thanks! I will try and start with the basics. Did you use XBase just like in the home automation example? I feel like it's not really needed.

Any example would be really helpful! If i get things to work i'll try to post the it here.

Does anyone know of other resources that might help a newbie?
Re: YAML encoded DSL in xtext [message #1805988 is a reply to message #1805977] Tue, 30 April 2019 06:49 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
it should work with no xbase as well.
i dont know an existing yaml xtext grammar you can copy & paste (am not even sure if yaml is really a good example for a whitespace aware language)
but: what is the exact "problem" an example would help you with
maybe this query helps
https://github.com/search?q=%22synthetic%3ABEGIN%22+%22synthetic%3AEND%22&type=Code


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:resolve references between two files in webUI
Next Topic:What Industry Wants from Academia in Software Modeling
Goto Forum:
  


Current Time: Sat Apr 20 01:30:42 GMT 2024

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

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

Back to the top