RUNTIME VALUE CONVERSIONS
Inspect the connection between your Python and generated C, with checked source identities and output ranges.
Select Transpile → Runtime, convert the source, and open Generated C. With ForgeLens enabled in the editor settings, place the cursor in Python or generated C to highlight the recorded corresponding ranges. Navigation uses the same existing ForgeLens controls and styling as Typed conversion.
def total(texts):
result = 0
for text in texts:
try:
result += int(text)
except ValueError:
continue
return result
def main():
print(total(["12", "bad", "3"]))
return 0
Expected output when built and run:
15
Place the cursor on int(text) to inspect its emitted operations. A single Python expression can produce several C ranges for values, runtime checks, and control flow. Function setup and module registration can map to their containing definition. The mappings describe emission origins, not a one-line-to-one-line translation.
Runtime support routines, shared tables, and other C-only scaffolding have no Python origin. Selecting them does not invent a source match. Comments and source forms with no emitted operation need not have an individual mapping. Imported companion modules retain their own authenticated source identities.
After emission, a separate validator consumes the final C and provenance records. It independently parses the supplied Python to check syntax ranges. PyCForge publishes output only when all checks pass.
| Check | What it establishes |
|---|---|
| Source identity | Module IDs, logical filenames, and content hashes exactly cover the supplied source bundle. |
| Source ranges | Every recorded origin has the character range and syntax kind of an actual Python AST node, including Unicode and CRLF source. |
| Output ranges | Ordered, nonempty ranges cover all generated UTF-8 bytes without gaps or overlap. Lines, character columns, and byte offsets agree. |
| C structure | Comments and literals terminate; parentheses, brackets, and braces balance; runtime template markers are resolved. |
| Callable and jump records | Each emitted callable has one matching Runtime ABI declaration and definition. Generated jump destinations exist and generated labels are unique. |
| Bounds and cancellation | Final output and provenance stay within conversion budgets; cancellation is observed during validation. |
The conversion summary contains an output_validation receipt with a passed status, generated-C SHA-256, byte count, source document/origin counts, range count, and the checks performed. The final stage artifact contains the source/output mappings. A failed integrity check produces PYC4698 and no new generated C or mappings.
ForgeLens belongs to the exact converted source revision and generated output. Editing source retires the old mappings. Convert again to obtain current ranges.
The separate warning-triangle button beside Tools opens the same one-line feedback as the Diagnostics tab after a failed conversion. Select an available row to highlight its source location. A source edit disables that quick view immediately; undo does not revive it. A new failed conversion supplies new locations. Unlocated diagnostics remain readable without a jump action.
The Tools arrow opens recent Scan Python Code findings. Both the full scan and its compact view mark old results stale as soon as a scanned source or included companion changes. Re-scan to refresh locations. Switching tabs alone does not invalidate results. Untouched Windows CRLF files remain navigable; their editor newline normalization is not treated as an edit.
These checks validate Runtime output structure and provenance. They do not establish full Python/C semantic equivalence and do not run a C compiler, linker, or your program. Runtime continues to report the PYC4699 warning explaining its conversion contract and checks. The established Typed C-IR proof pipeline does not apply to this backend.
Compile and test generated C with the intended toolchain and inputs. Runtime uses a caller-owned arena released with pv_destroy. C callers can opt into explicit collection between completed calls to reclaim unreachable values. See standalone builds, C callers, and conversion contracts.