thiagoralves
At Autonomy, we've spent over a decade building open-source tools for industrial automation. In 2023 we rewrote OpenPLC from the ground up as a modern, web-based platform with OpenPLC v4. But one critical dependency remained: the Structured Text compiler.
 
For two decades, MatIEC has been the only viable open-source compiler option. Indeed MatIEC is a remarkable contribution to the community, but it supports only IEC 61131-3 v2, generates macro-heavy C, and is showing its age. Recent efforts to fill this gap exist, but none have reached production readiness with full Edition 3 support yet.
 
That's why we worked hard to create STruC++. STruC++ generates readable C++17 with actual classes, virtual methods, and templates. It supports IEC 61131-3 Edition 3 with OOP (methods, interfaces, inheritance, properties), CODESYS extensions (POINTER TO, typed literals, 64-bit types), and direct CODESYS library import (OSCAT Basic 335 compiles out of the box). It ships with an interactive REPL: compile with --build and step through cycles, inspect variables, force values, and view ST/C++ side by side. And because it's built in TypeScript, it runs in the browser too!

But here's what we're most excited about: STruC++ has built-in unit testing. Every PLC testing solution today (TcUnit, CfUnit, CODESYS Test Manager) requires a specific IDE, runtime, or hardware. STruC++ has a test runner in the compiler itself. Write tests in ST, run them anywhere:
 
strucpp source.st --test tests.st
 
Tests run on your laptop and in your CI pipeline. See it in action: https://github.com/Autonomy-Logic/smart-traffic-light
 
We believe STruC++ can become a shared foundation for a modern, vendor-neutral IEC 61131-3 compiler that the entire community can build upon.

Reply 3 0
lexre09
So that are NEWS!!! So the implementation into CODESYS works. Does it work the other way around too? So for example i got an .export or .xml. from CODESYS. Does it have the main functionalities of the CODESYS development env. or the libraries?
Reply 0 0
thiagoralves
Yes it does! STruC++ has its own library format (.stlib), but that’s pretty much a JSON with some metadata and the pure-text source code of the library in ST and C++. It can also import CODESYS v2 (.lib) and v3 (.library) files by extracting their structured text content and creating a proper .stlib file with that. I did it with the OSCAT Basic library and it imported and compiled it perfectly.

If you have pure Structued Text CODESYS projects, please give STruC++ a go and check if it can compile your projects as is. The idea is that it will be 100% CODESYS compatible. If you have issues with the compilation let me know please
Reply 0 0
lexre09
okay i will try it with some smaller project files first and then i will try some of the big ones from work. im expecting just running the compiler will brick some of the custom made libs for the scada networks, but i will try some of our work arounds. im going to give a heads up
Reply 1 0
FutureHorizon
This is amazing news, when will the old compiler be replaced?
What is the current development status on it? How far from "production ready" is it?
Reply 0 0
thiagoralves
It works, but we will need a bit more testing with real world examples before we pull the trigger. Our plan is to make a build of the editor using STruC++ for the community to test an report back any issues
Reply 1 0
FutureHorizon
I can maybe find a bit of time to test :-)
Reply 0 0
thiagoralves
Awesome! Feel free to test it whenever you can. The repository already has the prebuilt binaries for it that you can simply download and test - See https://github.com/Autonomy-Logic/STruCpp/releases
 
Create a pure Structured Text program, download STruC++, and then run it with your program like this:
 
strucpp my_program.st --build
 
This will build a binary file called my_program (or my_program.exe if you're on Windows) that you can run on the terminal / command prompt. Once it is running, type help to understand all commands available. You should be able to see variables, force variables, run cycles, etc.
Reply 0 0
plcwill
This is good news for Open PLC. The question that I have is. How will this Structured Text compiler work for the Arduino boards?
Reply 0 0
thiagoralves
The same way the current compiler works: by generating C++ code for them (although the current compiler generates C instead of C++)
Reply 0 0
plcwill
Does this mean we will still need the Arduino software for this?
Reply 0 0
thiagoralves
No, the compilation process won’t change. You don’t need Arduino software to compile. OpenPLC comes bundled with everything you need.
Reply 0 0
Merva
This is amazing dear Thiago, thk you very much for your very good job ; we will test it 🙏
Reply 1 0
Reply