Attention
IronPLC supports IEC 61131-3 Structured Text excluding I/O mapping.
ironplcc¶
Name¶
ironplcc — IronPLC compiler
Synopsis¶
Description¶
ironplcc is the IronPLC compiler command line interface. It checks
IEC 61131-3 source files for correctness and compiles them into bytecode
container (.iplc) files for execution by the ironplcvm runtime.
Most developers will use ironplcc through the Visual Studio Code extension, but you can also use it directly, for example, to implement a continuous integration pipeline.
When a command accepts multiple files, the files are treated as a single compilation unit (essentially combined for analysis). Directory names can be given to add all files in the given directory.
See also
See Source Formats for all supported source file formats.
Commands¶
Build Commands¶
- ironplcc check [FILES…]
Check source files for syntax and semantic correctness without producing output. On success, the command produces no output.
- ironplcc compile [FILES…]
-oOUTPUT Compile source files into a bytecode container (
.iplc) file. Requires the--output(-o) flag to specify the output file path.Warning
The compile command currently supports only trivial programs. Supported features include:
PROGRAMdeclarations,INTvariable declarations, assignment statements, integer literal constants, and the+(add) operator. Programs using other features will produce a code generation error.
Diagnostic Commands¶
- ironplcc echo [FILES…]
Parse source files and write the parsed representation to standard output. This is primarily useful for diagnostics and understanding the internal structure of the parsed files.
- ironplcc tokenize [FILES…]
Tokenize source files and verify that all content matches a token. This is primarily useful for diagnostics and understanding the lexer behavior.
Informational Commands¶
- ironplcc dialects
Show available dialects and which features each enables. Use this to discover which
--allow-*flags a dialect includes.- ironplcc version
Print the version number of the compiler.
Other Commands¶
- ironplcc lsp
--stdio Run in Language Server Protocol mode to integrate with development tools such as Visual Studio Code. Communication uses standard input/output.
Options¶
-v,--verboseTurn on verbose logging. Repeat the flag to increase verbosity (e.g.,
-vvv).-lFILE,--log-fileFILEWrite log output to the specified file instead of the terminal.
--dialectDIALECTSelect the language dialect. A dialect sets the IEC 61131-3 edition and a default set of vendor extensions. Individual
--allow-*flags can override the dialect’s defaults. Available values:iec61131-3-ed2(default),iec61131-3-ed3,rusty. See Enabling Dialects and Features for details.--allow-c-style-commentsAllow C-style comments (
//line comments and/* */block comments). This is a vendor extension not part of the IEC 61131-3 standard.--allow-missing-semicolonAllow missing semicolons after keyword statements like
END_IFandEND_STRUCT. This is a vendor extension not part of the IEC 61131-3 standard.--allow-top-level-var-globalAllow
VAR_GLOBALdeclarations at the top level of a file, outside of aCONFIGURATIONblock. This is a vendor extension not part of the IEC 61131-3 standard.--allow-constant-type-paramsAllow constant references in type parameters (e.g.,
STRING[MY_CONST]orARRAY[1..MY_CONST] OF INT). This is a vendor extension not part of the IEC 61131-3 standard.--allow-empty-var-blocksAllow empty variable blocks (
VAR END_VAR,VAR_INPUT END_VAR, etc.). This is a vendor extension not part of the IEC 61131-3 standard.--allow-time-as-function-nameAllow
TIMEto be used as a function name (e.g.,TIME()). Required for OSCAT compatibility. This is a vendor extension not part of the IEC 61131-3 standard.--allow-ref-toAllow
REF_TO,REF(), andNULLsyntax without enabling full Edition 3. This is a vendor extension useful when you need references but want to keep Edition 2 keyword handling for the rest of your code.--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, treating0asFALSEand1asTRUE. This is a vendor extension supported by CoDeSys, TwinCAT, RuSTy, and virtually every PLC runtime.--allow-sizeofAllow 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.--allow-cross-family-wideningAllow implicit widening between bit-string and integer type families (e.g.
BYTEtoINT, literal0toBYTE). This is a vendor extension supported by CODESYS, TwinCAT, and RuSTy.
Examples¶
Check a source file for correctness:
ironplcc check main.st
Check all files in a directory:
ironplcc check src/
Compile a source file to a bytecode container:
ironplcc compile main.st -o main.iplc
Compile with verbose logging to a file:
ironplcc -vv --log-file build.log compile main.st -o main.iplc
Inspect the parsed representation of a file:
ironplcc echo main.st
Check a source file using IEC 61131-3:2013 (Edition 3) features:
ironplcc check --dialect iec61131-3-ed3 main.st
Show available dialects and their features:
ironplcc dialects
See Also¶
ironplcvm — IronPLC virtual machine runtime
Overview — Getting started tutorial
Source Formats — Supported source file formats
Problem Codes — Compiler problem code index