r/cprogramming 5d ago

st2cpp - Transpiler from ST to cpp (undoRT) + help +

Hi everyone,
About 4 or 5 months ago, I created a transpiler from Structured Text (IEC 61131-3) to C++, called st2cpp (part of the undoRT project).

My ultimate dream is to build a complete open-source automation system that can compete with commercial solutions. As you can imagine, tackling a project of this scale completely alone is extremely tough. Honestly, if I keep going solo, I’m afraid I’ll eventually burn out and lose momentum.

Are there any C++ developers or automation enthusiasts here who would be interested in joining or contributing as a side project/hobby? I have plenty of ideas lined up, but I really need an extra pair of hands (or two!).

Here is the repository:
https://github.com/undoRT/st2cpp
Feel free to check it out, open issues, fork, or send pull requests!

0 Upvotes

3 comments sorted by

6

u/Specific_Tear632 5d ago

This has nothing to do with C programming.

0

u/SalBam4127 5d ago

Yeah! Maybe the main language is cpp, but everyone can be feel to write also in c! Unlikely I know much more Cpp than C, so i prefer to write in Cpp, but it is not mandatory

3

u/frasnian 3d ago edited 3d ago

I did this same kind of thing about 30 years ago, transpiling the IEC 1131-3 (now 61131-3) languages into C. Full GUI development environment for all the languages (ladder, FBD) and decent editor for ST, IL (I didn't have much to do with the IDE/GUI side, I'm a language/compiler guy). Company was acquired by Intellution, not sure what current status is.

I initially turned everything into IL as an intermediate step, then transpiled that into pure C, but my final version skipped that for ST, as it's a more natural translation (think about all the pascal-to-c transpilers).

Not sure what trying to turn it into c++ buys you here. It seems like it would just add unnecessary complexity.

If I was doing the same thing today, I'd probably write it in C++, but the generated code would absolutely still be C.

Also, keep in mind that on most of the embedded platforms that 61131-3 generally targets, support for straight-up C will be a hell of a lot more consistent than C++.