Posts Tagged ‘ Grammar ’

URLs in Xtext

DSLs often include URLs. However, Ecore does not provide such a datatype by default. Also Xtext doesn’t provide a native rule for entering URLs as it is available for strings or integers.

In this post, I will explain all the nescessary steps to use URLs in Ecore models and in Xtext-based DSLs.
Continue reading

Xtext based Lua-Editor

Lua is an imperative programming language. It was designed to be embedded as programming language within other programs. Lua uses automatic memory management with garbage collection. It is dynamically typed and provides coroutines. The Lua interpreter has a low memory footprint and is even suitable for embedded systems.

Lua uses a very simple grammar with specialized list operations. The complete symtax can be found here.

In this post we use Xtext to develop an IDE for this real-world programming language.
Continue reading

Generate EBNF-Descriptions for Xtext-based DSL

Creating DSLs in Xtext is easy and works out of the box. However, when it comes to documentation,  things get tricky. Your DSL should be used by other programmers to model a system that maybe didn’t take part in defining the language. So how can you describe the usage of your language to these guys?

Of course there is the possibility to provide code-snippets as examples and the tool support Xtext generated for your languages eases its use. However, sometimes a more complete documentation is useful. Using the original .xtext file for that purpose is not the best way, because its crowded with internal information for the parser that the user of the DSLs doesn’t care about. Furthermore, only few people are used to the Xtext-Language. The good old way is to provide a BNF or EBNF description of the language.

In this posts I will describe how to automatically generate EBNF descriptions for your DSL.
Continue reading