P4033

Code

P4033

Message

Partial-access syntax (.%Xn) requires –allow-partial-access-syntax flag

This error occurs when a source uses the IEC 61131-3:2013 partial-access bit syntax (.%Xn) without enabling it. Partial-access syntax is standardized in Edition 3 of IEC 61131-3 but is not part of Edition 2, so it is gated behind the --allow-partial-access-syntax flag (also enabled by the rusty and iec61131-3-ed3 dialect presets).

Example

The following code will generate error P4033:

PROGRAM main
VAR
    b : BYTE;
    r : BOOL;
END_VAR
    r := b.%X0;
END_PROGRAM

To fix this error, either use the Edition 2 short form .n:

r := b.0;

Or enable partial-access syntax with one of:

  • --allow-partial-access-syntax

  • --dialect=iec61131-3-ed3

  • --dialect=rusty

Scope

IEC 61131-3:2013 defines partial access at five granularities — .%Xn (bit), .%Bn (byte), .%Wn (word), .%Dn (double word), and .%Ln (long word). IronPLC currently implements only the bit form .%Xn behind this flag. The wider forms are recognized as partial-access syntax and therefore also raise P4033 when the flag is off; they are not yet accepted when the flag is on and still produce a lexer error there. See Bit Access for the full feature description and current support status.

Think IronPLC is wrong about this?

If you believe this diagnostic is incorrect, open an issue on GitHub with a small sample that demonstrates the problem.