fesch / Structorizer.Desktop

Structorizer is a little tool which you can use to create Nassi-Schneiderman Diagrams (NSD).
https://structorizer.fisch.lu
GNU General Public License v3.0
66 stars 20 forks source link

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

Open mmeiborg opened 3 years ago

mmeiborg commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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 commented 3 years ago

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

codemanyak commented 2 years ago

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.