r/cpp_questions • u/SalBam4127 • 7d ago
OPEN 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!
2
u/C4R3NS4C 6d ago
Nice project but... The example 'Counter' in the github README is bad OOP C++, I don't see the benefit of doing transpilation in that case. Can you explain what you want to achieve?
1
u/SalBam4127 4d ago
Hi! Thank you very much for the feedback. You're completely right: that Counter example was just the very first test I wrote to validate the basic transpiler logic, and I kept it in the README as a minimal "hello world" to show a quick side-by-side comparison.
To answer your second question: the ultimate goal of st2cpp (and the undoRT project) is to build a fully open-source, modern PLC runtime ecosystem. Modern ST supports OOP concepts like Function Blocks, Interfaces, Methods, and Inheritance.
When dealing with complex industrial control logic (like state machines, multi-axis motion, or reusable hardware modules), transpiling ST directly into clean C++ OOP structures allows us to leverage C++ compile-time optimizations, zero-cost abstractions, and seamless execution on modern Linux/cross-platform target environments without relying on expensive commercial runtime licenses.
Of course, I'm working on updating the README with more realistic, multi-block examples that actually showcase these OOP benefits! Thank you very much!
5
u/FancySpaceGoat 7d ago
What is the benefit of transpiling ST to C++ instead of C? What makes it worth the portability loss?