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:
We believe STruC++ can become a shared foundation for a modern, vendor-neutral IEC 61131-3 compiler that the entire community can build upon.