Static analysis for IEC 61131-3 programs. Currently supports Structured Text, PLCOpen XML and SEL XML input formats.
The Structured Text dialect accepted by the parser is compatible with the matiec transpiler.
The codebase is split into four public libraries. Each library has a single top-level module that re-exports its public API.
IECCheckerCore — iec_checker.coreCore data structures shared by every other component: the AST (IECCheckerCore.Syntax), control-flow graph (IECCheckerCore.Cfg), warning representation (IECCheckerCore.Warn), JSON dump format (IECCheckerCore.Dump), PLCOpen XML reader (IECCheckerCore.Plcopen) and SEL XML reader (IECCheckerCore.Sel).
IECCheckerParser — iec_checker.parserThe lexer, Menhir grammar and source-location tracking. Turns Structured Text text into the AST defined in IECCheckerCore.Syntax.
IECCheckerAnalysis — iec_checker.analysisGeneric semantic analyses that the rule library builds on top of: declaration analysis (IECCheckerAnalysis.Declaration_analysis), use-define chains (IECCheckerAnalysis.Use_define), unused-variable detection (IECCheckerAnalysis.Unused_variable) and cyclomatic-complexity scoring (IECCheckerAnalysis.Cyclomatic_complexity).
IECCheckerLib — iec_checker.libThe actual checks. Implements the PLCOpen Software Construction Guidelines (modules Plcopen_cp1 … Plcopen_cp28, Plcopen_l10, Plcopen_l17, Plcopen_n3). IECCheckerLib.CheckerLib is the entry point invoked by the iec_checker binary.
src/bin/iec_checker.ml (not part of the documented API).IECCheckerLib.CheckerLib.IECCheckerCore.Dump.