Attention

IronPLC implements many parts of the IEC 61131-3 standard and is working toward full Structured Text support. Key features still missing include ranges, enum and I/O mapping.

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:

  1. Open File ‣ Preferences ‣ Settings (or Code ‣ Preferences ‣ Settings on macOS).

  2. Search for ironplc.

  3. Change Dialect to the desired value (e.g., rusty or iec61131-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-comments

Allow 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-semicolon

Allow missing semicolons after keyword statements like END_IF and END_STRUCT.

--allow-top-level-var-global

Allow VAR_GLOBAL declarations at the top level of a file, outside of a CONFIGURATION block. See Variable Scope.

--allow-constant-type-params

Allow constant references in type parameters such as array bounds and string lengths (e.g., ARRAY[1..MY_CONST] OF INT or STRING[MY_CONST]). See Array Types.

--allow-empty-var-blocks

Allow empty variable blocks (VAR END_VAR, VAR_INPUT END_VAR, etc.). Some PLC environments permit variable blocks with no declarations.

--allow-time-as-function-name

Allow TIME to be used as a function name (e.g., TIME()). Required for OSCAT compatibility where TIME() reads the PLC system clock.

--allow-ref-to

Allow REF_TO, REF(), and NULL syntax 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-arithmetic

Allow arithmetic (+, -) and ordering comparisons (<, >, <=, >=) on REF_TO types. By default, only = and <> are permitted on references.

--allow-int-to-bool-initializer

Allow integer literals 0 and 1 as BOOL variable initializers (e.g., debug : BOOL := 0;). The compiler rewrites 0 to FALSE and 1 to TRUE. This is a universal vendor extension supported by CoDeSys, TwinCAT, RuSTy, and virtually every PLC runtime.

--allow-sizeof

Allow the SIZEOF() operator that returns the size in bytes of a variable or type. This is a vendor extension supported by CODESYS, TwinCAT, and RuSTy. See SIZEOF.

--allow-cross-family-widening

Allow implicit widening between bit-string and integer type families. For example, passing a BYTE variable where an INT parameter is expected, or passing a bare integer literal 0 where a BYTE parameter is expected. This is a vendor extension supported by CODESYS, TwinCAT, and RuSTy.

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.