pyfcstm.diagnostics.analyzers.numeric

C/C++ deployment-profile numeric diagnostics.

This module implements the lightweight numeric analyzer used by pyfcstm.diagnostics.inspect.inspect_model(). The analyzer is target profile aware: each warning describes a risk for the default C/C++ generated runtime profile rather than a target-independent FCSTM model error.

The module contains:

Note

The analyzer deliberately avoids variable range solving, cross-statement propagation, SMT checks, and generated-code policy changes. Those belong to the verify and code-generation tracks.

collect_numeric_warnings

pyfcstm.diagnostics.analyzers.numeric.collect_numeric_warnings(machine: StateMachine | None) List[ModelDiagnostic][source]

Collect C/C++ deployment-profile numeric warnings for a model.

Parameters:

machine (Optional[pyfcstm.model.StateMachine]) – State-machine model to inspect. None is accepted so callers can mirror other analyzer entry points during defensive composition.

Returns:

Numeric warnings in model traversal order.

Return type:

List[pyfcstm.utils.validate.ModelDiagnostic]

Examples:

>>> from pyfcstm.dsl import parse_with_grammar_entry
>>> from pyfcstm.model import parse_dsl_node_to_state_machine
>>> source = '''
... def int too_large = 9223372036854775808;
... state Root { state A; [*] -> A; }
... '''
>>> ast = parse_with_grammar_entry(source, 'state_machine_dsl')
>>> machine = parse_dsl_node_to_state_machine(ast)
>>> collect_numeric_warnings(machine)[0].code
'W_NUMERIC_LITERAL_OUT_OF_TARGET_RANGE'