Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could I help with Octave (Matlab) language support? #981

Open
mmeiborg opened this issue Jul 18, 2021 · 4 comments
Open

Could I help with Octave (Matlab) language support? #981

mmeiborg opened this issue Jul 18, 2021 · 4 comments

Comments

@mmeiborg
Copy link

Hello!

How about Octave (Matlab) support for Structorizer?

I do design work in Octave (open source Matlab equivalent, website grabs below). The language has similarities with C, though it is interpreted, not compiled. You can declare variables on the fly, and it uses no brackets {, } for functions, loops, etc... It is highly vector-matrix oriented. When a project is up and running it is relatively straightforward to port it to C/C++ with a library as Armadillo.

What does it take to add support for a new language to Structorizer. I could image there is a sort of table or template to fill out, in which case I might be able to do much of the work. Or is it is quite elaborate and low-level?

Let me know if this is a plan and how to get started.

@mmeiborg

OCTAVE is scientific programming language. Mathematics-oriented syntax with built-in 2D/3D plotting and visualization tools. Open source, runs on GNU/Linux, macOS, BSD, and Microsoft Windows. Compatible with many Matlab scripts

MATLAB is a programming and numeric computing platform used by millions of engineers and scientists to analyze data, develop algorithms, and create models.

@fesch
Copy link
Owner

fesch commented Jul 18, 2021

There is no "template" as such, but you could just take one of the existing generator classes, make a copy and adapt it.

Explanations on how to write a new generator have been added by @codemanyak and are here:
https://github.com/fesch/Structorizer.Desktop/blob/master/src/lu/fisch/structorizer/generators/howto.txt

The same folder contains the existing generator classes:
https://github.com/fesch/Structorizer.Desktop/tree/master/src/lu/fisch/structorizer/generators

@codemanyak
Copy link
Collaborator

codemanyak commented Jul 20, 2021

There is no "template" as such, but you could just take on of the existing generator classes, make a copy and adapt it.

@mmeiborg
There had been a proposal towards a template-based Generator design in issue #850 but, as Bob told, this idea has not been spent serious efforts yet (due to lacking time and because a projected but unaccomplished redesign according to issue #800 is deemed a sensible prerequisite). So by now you can indeed only follow the approach described in the howto.txt file.

Many thanks for your initiative and your contribution offer in advance. In a first step, the code generation for a single diagram would be fine. Additional complexity, however, is imposed by recursive export (i.e. involving called subroutine diagrams) and group export, in particular when combined with batch export. But there we can help when the basic generator code is ready. Please feel free to ask when questions arise.

@mmeiborg
Copy link
Author

Thank you, I'll have a try and keep you posted.

@codemanyak
Copy link
Collaborator

I think, one of the major challenges is that most of the interesting mathematical stuff for Octave / Matlab is not directly expressible in Structorizer. Not at least in a way that Structorizer could interpret. Think e.g. of matrix notations, vector operations etc. So it would be up to a somewhat blind passing of possibly misjudged text through the code generation mechanisms in the hope that it won't get completely muddled or screwed, I am afraid. Lots of the expressive power of Matlab would just be left idle. The attempt of an intelligent translation of e.g. loops over arrays from Structorizer into compact Octave / Matlab expressions on the other hand looks rather ambitious for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants