QUICK REFERENCE

Conversion checklist

Use this sequence to turn supported Python functions into C that you can build and test confidently.

Prepare the Python

  1. Start with a small function whose expected results you know.
  2. Annotate each parameter and return value with a supported type.
  3. Assign every local before reading it, including after branches and loops.
  4. Keep each variable's type consistent. Use 1.0 when you mean a float.
  5. Keep module values constant during function calls. Pass changing values as parameters.
  6. Check string operations against the supported string table.

Convert and correct errors

  1. Add all files needed by function imports. Remove unintended empty modules.
  2. Choose Transpile Source Bundle, or run pycforge convert input.py --output output.c.
  3. If conversion is rejected, open the first diagnostic and fix the indicated source. An annotation does not make an unsupported expression convertible.
  4. Convert again after each correction. Save C only when the result is current and successful.

Build with your C toolchain

PyCForge produces C source. It does not compile or run it. A converted function is not automatically a standalone program with main. Compile the output as part of your C application, or use a small C test program that calls the generated function.

For example, use an installed GCC compiler to check and compile the output to an object file.

gcc -std=c11 -Wall -Wextra -c output.c -o output.o

Review compiler messages and the generated function declarations. String arguments need valid UTF-8 storage; file functions add an error-status argument and may return memory you must release. See passing strings from C and checking file errors.

Compare results with Python

Keep a reproducible example

Save the Python inputs, the PyCForge version, the generated C, and your test inputs and expected results. When reporting a problem, reduce it to the smallest example that still shows the issue, and include the exact diagnostic or compiler message.