Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » XBase language + Matlab code generation?
XBase language + Matlab code generation? [message #1743024] Fri, 09 September 2016 15:10 Go to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
Hi,

I started writing a language with Xtext and so far everything goes well. Recently I noticed that most of the language features I need are similar to Java's and I thought I might as well use XBase. So far I have the impression that XBase ships with a default code generator for Java as a target language, but my project also requires code generation to Matlab code.

Can I achieve that?
Does it mean I need build a code generator from scratch?
Can I selectively disable language features?

Thanks for any help.
Re: XBase language + Matlab code generation? [message #1743038 is a reply to message #1743024] Fri, 09 September 2016 19:49 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Xbase uses a IGenerator to generate the code from the inferred jvm model as well. the class that is used is JvmModelGenerator.
you can simply hook in there


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
Re: XBase language + Matlab code generation? [message #1743049 is a reply to message #1743038] Fri, 09 September 2016 23:20 Go to previous messageGo to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
Ok I see.

Anybody has a pointer that describes how to build a xbase code generator from scratch? I'm currently reading the book from Lorenzo bettini, but it does not describe that...
Re: XBase language + Matlab code generation? [message #1743055 is a reply to message #1743049] Sat, 10 September 2016 05:29 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Can you be a bit more specific about what you warnt to do

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
Re: XBase language + Matlab code generation? [message #1743059 is a reply to message #1743055] Sat, 10 September 2016 05:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
Of you Want to turn all xbase expressions into expressions of another language your main problem might be that that other language does not have Java type system. But you may have a look into XbaseCompiler and superclasses to get an idea

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
Re: XBase language + Matlab code generation? [message #1743065 is a reply to message #1743059] Sat, 10 September 2016 07:06 Go to previous messageGo to next message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
Our company sells embedded product. Developers are maintaining a hand-written pure C codebase. Testers are are analyzing what comes out of receivers (formatted binary data) in various intepreted languages such as python and Matlab with the help of manually-written code generators. GUI guys are also maintaining a C++ codebase written with different code generators but consuming the same formatted binary data. Currently I'm developing a DSL which provides all necessary concepts in a unified way. I'm at a point where I can describe some of the behavior of the product so I need to extend my language with rich expressions and deals with scoping, conformance and various concepts which are similar to Java. For sure C, C++, python and Matlab type system do not all ressemble java type system, but I thought it might be more efficient to start from a subset of xbase rather than manually extending my language with all necessary concepts.

Am I thinking wrong about this?
Re: XBase language + Matlab code generation? [message #1743066 is a reply to message #1743065] Sat, 10 September 2016 07:31 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13887
Registered: July 2009
Senior Member
depending on your expressions it might be easier to create a simple expression language that supports +-*/ || && == < > <= >= and () and use e.g. XSemantics to build a type system for that

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
Re: XBase language + Matlab code generation? [message #1743083 is a reply to message #1743066] Sun, 11 September 2016 19:40 Go to previous message
Eric Salemi is currently offline Eric SalemiFriend
Messages: 35
Registered: September 2016
Location: Belgium
Member
Never heard of xsemantics. I'll have a look at it.
Previous Topic:Parsing of language fragments
Next Topic:XText suggests left-factoring. Why?
Goto Forum:
  


Current Time: Mon Apr 19 18:04:39 GMT 2021

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

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

Back to the top