Attention

IronPLC can only run very simple programs. The steps described are accurate but many language features are not yet supported.

ironplcc

Name

ironplcc — IronPLC compiler

Synopsis

ironplcc [OPTIONS] COMMAND

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…] -o OUTPUT

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: PROGRAM declarations, INT variable 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.

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.

ironplcc version

Print the version number of the compiler.

Options

-v, --verbose

Turn on verbose logging. Repeat the flag to increase verbosity (e.g., -vvv).

-l FILE, --log-file FILE

Write log output to the specified file instead of the terminal.

Examples

  1. Check a source file for correctness:

    ironplcc check main.st
    
  2. Check all files in a directory:

    ironplcc check src/
    
  3. Compile a source file to a bytecode container:

    ironplcc compile main.st -o main.iplc
    
  4. Compile with verbose logging to a file:

    ironplcc -vv --log-file build.log compile main.st -o main.iplc
    
  5. Inspect the parsed representation of a file:

    ironplcc echo main.st
    

See Also