Attention
IronPLC implements many parts of the IEC 61131-3 standard and is working toward full Structured Text support. Key features still missing include arrays and structures. Try it out in the IronPLC Playground.
Enabling Dialects and Features¶
IronPLC aims to let you take code from another PLC environment and use it
without changes. To support this, IronPLC uses dialects — named presets
that select the IEC 61131-3 edition and a default set of vendor extensions.
Individual --allow-* flags provide fine-grained control on top of the
selected dialect.
Supported Dialects¶
- iec61131-3-ed2 (default)
Strict IEC 61131-3:2003 (Edition 2). No vendor extensions are enabled. This is the default when no dialect is specified.
- iec61131-3-ed3
Strict IEC 61131-3:2013 (Edition 3). Enables Edition 3 keywords including LTIME, LDATE, LTIME_OF_DAY, LDATE_AND_TIME, REF_TO, REF, and NULL. No vendor extensions.
- rusty
RuSTy-compatible dialect. Uses Edition 2 as a base (so Edition 3 type names like LDT remain available as identifiers) and enables REF_TO support plus all vendor extensions.
Editions are additive — enabling a later edition includes all features from earlier editions.
See Edition Support for a complete list of features that require a specific edition.
Tip
Run ironplcc dialects to see which features each dialect enables.
How to Select a Dialect¶
Command Line¶
Pass the --dialect flag when running ironplcc:
ironplcc check --dialect rusty main.st
ironplcc check --dialect iec61131-3-ed3 main.st
See ironplcc for all compiler options.
Visual Studio Code¶
Set the ironplc.dialect setting:
Open (or on macOS).
Search for
ironplc.Change Dialect to the desired value (e.g.,
rustyoriec61131-3-ed3).
Or add it directly to your settings.json:
{
"ironplc.dialect": "rusty"
}
See Settings Reference for all extension settings.
Enabling Specific Features¶
Individual --allow-* flags can be combined with any dialect to enable
additional features on top of the dialect’s defaults. Flags can only enable
features — they never disable features that a dialect already includes.
--allow-c-style-commentsAllow C-style comments (
//line comments and/* */block comments). These are not part of the IEC 61131-3 standard but are supported by many PLC environments.--allow-missing-semicolonAllow missing semicolons after keyword statements like
END_IFandEND_STRUCT.--allow-top-level-var-globalAllow
VAR_GLOBALdeclarations at the top level of a file, outside of aCONFIGURATIONblock. See Variable Scope.--allow-constant-type-paramsAllow constant references in type parameters such as array bounds and string lengths (e.g.,
ARRAY[1..MY_CONST] OF INTorSTRING[MY_CONST]). See Array Types.--allow-empty-var-blocksAllow empty variable blocks (
VAR END_VAR,VAR_INPUT END_VAR, etc.). Some PLC environments permit variable blocks with no declarations.--allow-time-as-function-nameAllow
TIMEto be used as a function name (e.g.,TIME()). Required for OSCAT compatibility whereTIME()reads the PLC system clock.--allow-ref-toAllow
REF_TO,REF(), andNULLsyntax without enabling full Edition 3. This is useful when you need references but want to keep Edition 2 keyword handling for the rest of your code. See Reference Types.--allow-pointer-arithmeticAllow arithmetic (
+,-) and ordering comparisons (<,>,<=,>=) onREF_TOtypes. By default, only=and<>are permitted on references.--allow-int-to-bool-initializerAllow integer literals
0and1asBOOLvariable initializers (e.g.,debug : BOOL := 0;). The compiler rewrites0toFALSEand1toTRUE. This is a universal vendor extension supported by CoDeSys, TwinCAT, RuSTy, and virtually every PLC runtime.
Pass the flag when running ironplcc:
ironplcc check --allow-c-style-comments --allow-empty-var-blocks main.st
Or combine with a dialect:
ironplcc check --dialect iec61131-3-ed3 --allow-c-style-comments main.st
See ironplcc for all compiler options.