See the example program attached to this comment: https://github.com/p4lang/p4-spec/issues/1262#issuecomment-1775914075