Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using an Xbase subset
Using an Xbase subset [message #1759651] Fri, 14 April 2017 14:17 Go to next message
Marco Ullrich is currently offline Marco UllrichFriend
Messages: 14
Registered: December 2016
Location: Bayreuth
Junior Member
Hello everyone,

during my studies I created an beginner-friendly procedural programming language for educational purpose.
Hence the language had to be simple it only needed to support basic expressions (like additions, multiplikations, etc.) and primitive types like int, float, string and boolean (see attached xtext-file).
This language was created without Xbase because I thought the Xbase-Expressions would be to powerful and complicated for beginners.

Now i need to create a similar, but object-oriented, language.
The language should provide the same operations and types as the procedural language plus user defined classes/objects.
The language should also support debugging.
Therefor I decided to use Xbase this time because it supports debugging and i can quiet directly map my DSL to java-concepts.

But I still have the problem, that the provided expressions and types are too powerful.

I know, that i can rip out some parts of the Xbase-grammar by overriding the grammar-rules (e.g. XSynchronizedExpression).
But then i sill need to reduce the available Java-types to int ,float, string ,boolean and arrays / lists.

So my questions are:
1. Is it a good approach to use Xbase and cut it down to my needs or is there a simpler / better way?

2. Which parts of the framework (e.g. classes) would be a good starting-points for this customization

3. Because I only need a small subset of Xbase, would it be a good idea to skip the Xbase-grammar and use the JVM-Types ( directly or would this mean a lot of extra work because the validations rely on Xbase?

4. How can I reduce the available Java types to int ,float, string ,boolean and arrays / lists?

5. Are there alternatives to provide debugging for an Xtext DSL?

Thank you in advance and kind regards,
  • Attachment: Bali.xtext
    (Size: 3.85KB, Downloaded 71 times)
Re: Using an Xbase subset [message #1765633 is a reply to message #1759651] Mon, 12 June 2017 22:23 Go to previous messageGo to next message
Amit Yadav is currently offline Amit YadavFriend
Messages: 28
Registered: June 2017
Junior Member
+1 for this question. I have similar requirement so if there are any suggestion, that would be very useful.
Re: Using an Xbase subset [message #1765643 is a reply to message #1765633] Tue, 13 June 2017 03:10 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14491
Registered: July 2009
Senior Member
This question is basically unanswerable

(1) there is always an alternative. Depends on what you want to do
(2) this is the tricky part . Basically everything. It is really hard to impossible to really restrict xbase.
(3) yes this might be a way to go depending and what type of expressions you need .
If it is just +-*/ then a own expression Lang might be better

(4) this is the really tricky part. Do you mean declared types or do you mean all usages e.g. In a closure etc ....
(5) yes have a look at the new tracing support in Xtext 2.12.

Need professional support for Xtext, Xpand, EMF?
Go to:
Twitter : @chrdietrich
Blog :
Previous Topic:Adding a genmodl to the workflow
Next Topic:Priority/Order of contentassist proposals (in particular templates)
Goto Forum:

Current Time: Sun May 28 16:18:46 GMT 2023

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

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

Back to the top