Using an Xbase subset [message #1759651] |
Fri, 14 April 2017 14:17  |
Marco Ullrich 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 (http://www.eclipse.org/xtext/common/JavaVMTypes) 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,
Marco
Attachment: Bali.xtext
(Size: 3.85KB, Downloaded 71 times)
|
|
|
|
Re: Using an Xbase subset [message #1765643 is a reply to message #1765633] |
Tue, 13 June 2017 03:10  |
|
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: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
Powered by
FUDForum. Page generated in 0.06160 seconds