GETTING STARTED
PyCForge owns compiler integration and qualification of Crucible-generated C. The separate SDK authors conversion extensions through standardized format files; it does not invoke or probe PCFC11 or any other C compiler.
Build the bundled PCFC11 0.2.68 compiler once with your local Python and GCC tools. PyCForge keeps it in a fixed location and checks the recorded build before use.
PCFC11 has its own C preprocessor, parser, conservative optimizer and x64 assembly generator. Its targets are Linux x86-64 with the LP64 data model and Windows x64 with LLP64; external GCC-compatible tools assemble and link the output. O0 is the baseline and O1 enables bounded integer optimizations. Shared control-flow, definition and liveness analyses preserve conservative fallback. Floating-point arithmetic uses no implicit fast-math or contraction.
Crucible supplies C from supported Python and conversion-import contracts; PCFC11 compiles that C, while the separate SDK supports import authoring and conversion checks. The full-width PCFC11 section at the bottom of About PyCForge summarizes this relationship, current features, engineering strategy and future objectives. Complete ISO C11 conformance is not established.
| Host | Local build tools |
|---|---|
| Windows x64 | Native 64-bit Python 3.11 or later and complete MinGW-w64 UCRT64 GCC, including its headers, libraries, assembler, linker and DLLs. MSYS2's UCRT64 environment supplies these tools. Select its ucrt64\bin\gcc.exe. |
| Linux x86-64 | Native 64-bit Python 3.11 or later, GCC, binutils and the system C headers/libraries. Bash is needed for the standalone shell test launcher. |
The PyCForge application supports Python 3.11–3.13. The standalone compiler build and tests need no third-party Python packages. PCFC11 emits x86-64 code for these two hosts; macOS, ARM64 and 32-bit hosts are outside this bundled compiler's supported route. Other C Compilers remains available for its supported targets.
PCFC11 parses and compiles C itself; GCC supplies assembly, linking and system runtime support. Keep the complete GCC installation. A lone gcc.exe copied without its supporting files is insufficient. PyCForge supplies no installers, downloads no tools, and never builds PCFC11 at startup. Missing PCFC11 does not prevent editing or transpilation.
C:\msys64\ucrt64\bin\gcc.exe; Linux commonly uses /usr/bin/gcc. Browse selects a file without executing it.A failed or canceled rebuild preserves the previous compiler. Recheck can confirm a retained build with current verification evidence. Closing setup or the workspace during a build requests cancellation and waits for the worker to finish. Builds and program compilation share a lock across PyCForge windows; a busy compiler reports that another operation must finish first.
A failed replacement is never accepted. If the compiler already in use still verifies, Continue to Compile remains available and the failure stays visible. Clicking Compile again checks that retained compiler without starting another build.
If a different retained build is compatible with this PyCForge release and its exact files and verification records still match, setup offers Use verified PCFC11 with its version. Select it, then continue to compile. The choice is remembered and rechecked before use. The compilation dialog shows the actual selected compiler and version. A later successful bundled build supersedes that choice.
Preserved files alone are insufficient. An unsupported older version, changed toolchain, damaged executable or incomplete Windows verification cannot be selected. When no verified compiler qualifies, use Copy Report, choose Other C Compilers… for current generated C, or correct the problem before choosing Retry PCFC11 Build. Closing and reopening Compile does not retry the build or tests automatically. Editing and transpilation remain available.
Setup retains last-build-attempt.json in the managed slot so the latest build failure remains available after reopening PyCForge. A previous-compiler choice never turns a failed replacement or a program's unexecuted checks into a successful result.
Native Windows builds run nine focused phases before the new compiler becomes ready: guarded stack growth; register preservation and native unwinding; ordinary integer updates; general Windows calling conventions, layouts, runtime headers and file/linker handling; parser limits with controlled diagnostics and preserved output; standalone C array loops compiled by the new PCFC11 at O2; and executable entry arguments at O0, O1 and O2. Setup runs the resulting Windows executable on empty, one-element and 31-element inputs. It checks every element, both guard values, integer counter results, signed and Boolean operand conversions, wide masks and the value returned by a narrowing compound assignment against independent answers. O0/O1 programs are compared with independent GCC references and integer expectations. These checks use the Python and UCRT64 GCC already selected in setup. Everything else is bundled with PyCForge; no separate test package, Bash session or manual test command is required. The seventh phase compiles the same argument wrapper that Compile uses. At each optimization level it launches 29 cases and checks exit status, standard output and standard error, including whether the entry ran. It exercises positional and named input and rejects unknown, repeated and incomplete options. The eighth phase checks text entry at O0, O1 and O2. Its 16 cases at each level cover the exact UTF-8 bytes, empty strings, quoting, help, malformed argument lists and opening a Unicode filename. The ninth phase checks mixed required parameters, file contents, and rejection before the entry runs. These are standalone C tests. They do not run Crucible conversions or SDK qualification. Each phase has a three-minute limit, and Cancel Build remains available. Each new compiler needs its own successful result from Build PCFC11.
A failure, timeout, cancellation or incomplete result prevents acceptance of the new build. Use the visible phase log and Copy Report to inspect the outcome. The managed slot retains last-windows-validation.json and last-windows-validation.log for the latest attempt. A successful build also keeps current/windows-validation.json, bound to its exact executable, bundled inputs and selected tools. Recheck and startup verify that evidence without rerunning the suite. An older Windows build without it needs one explicit rebuild; setup reports this requirement. Linux builds retain their existing verification workflow.
This finite local acceptance suite checks the selected compiler and machine. It does not certify all C11 programs or replace broader compiler qualification.
The managed slot is independent of the pip installation folder, virtual environment and working directory. This avoids requiring write access to site-packages and keeps the compiler available across PyCForge upgrades that bundle the same source. Its path includes the compiler release, source fingerprint and native target:
| Host | Managed executable |
|---|---|
| Windows | %LOCALAPPDATA%\PyCForge\compilers\pcfc11\0.2.68-c8f3ae4e2dd8\x86_64-w64-mingw32\current\PCFC11-0.2.68\pcfc11.exe |
| Linux | $XDG_DATA_HOME/PyCForge/compilers/pcfc11/0.2.68-c8f3ae4e2dd8/x86_64-linux-gnu/current/PCFC11-0.2.68/pcfc11, using ~/.local/share when XDG_DATA_HOME is unset or relative. |
The setup dialog shows the exact path for your account. Keep the compiler source, adjacent headers and build record together. The current folder contains build.json and build.log; a successful rebuild retains the replaced folder as previous. Publication is protected by a lock and rollback. If interruption leaves only a recorded previous build, the next check can restore it.
Normal startup compares SHA-256 content fingerprints for the executable, bundled source/build inputs, headers and saved GCC driver. It then runs a bounded compiler identity probe for name, release, target and process interface. Compile repeats verification before use. A small copper loading panel appears while this check runs; Cancel dismisses the request without opening a compile or setup dialog. The original code-bracket PyCForge icon identifies these compiler dialogs. A changed executable is refused before its identity command is run. A saved timestamp alone is never enough. Missing files or failed checks lead to setup, not an automatic rebuild. Recovery startup defers this optional compiler probe.
These checks establish continuity with the locally recorded build. They are not a publisher digital signature, a full toolchain attestation or proof of compiler correctness. Replacing both files and their local record is outside that guarantee. GCC helper programs, libraries and DLLs must remain compatible; their availability is checked by actual build/use, not by recursively hashing the entire toolchain. Moving or updating the saved GCC driver requires rebuilding PCFC11.
When a later PyCForge release bundles different compiler source, it gets a separate slot. Existing slots and separately extracted source folders are not removed by a pip uninstall. Use the displayed location when reviewing disk usage; close PyCForge before manually removing an obsolete slot.
Ctrl+Shift+Return).int. With verified PCFC11 0.2.68, select Allow launch arguments to include a function such as def score(value: int) -> int. Run the built program with one signed decimal integer, for example .\program.exe -42. The full signed 64-bit range is accepted. For a str entry, see Pass text or a file path. --help prints usage. Missing, extra, malformed and out-of-range input returns status 2 before entering the function. No-argument entries retain their previous behavior. Runtime entries return int or None and can accept one text value or file path. A function named start is a useful entry. For a C caller, choose a bare object or Typed object and matching headers (.zip). Extract the ZIP together. In pycforge_abi.json, find the module header, generated function name, target, and required link libraries. Include that header and link bundle.o once with your caller for the same target. The ZIP is replaced only after a fresh successful build.Build children receive the selected backend directory in PATH without modifying the application or system environment. Editing a participating source cancels an outdated program build; failure or cancellation preserves previous output. Program compilation never runs your program. Setup runs only its bundled verification programs. PCFC11 remains separate from Transpile → Other C Compilers…, which retains GCC, Clang, MSVC and Clang-cl.
O1 follows short-circuit paths in compound conditions when analyzing integer values and unused stores. Evaluation order and conversions are preserved. Unsupported analysis cases use the established compilation path; O0 remains available without these optimizations.
Generated Runtime C includes its value routines and does not need Python to execute on a compatible host. Compiler setup does not alter the Runtime memory and collection contract; active collection remains opt-in.
Save this as process.py and transpile in Typed mode. The path is required. Omit count to use 3.
def process(path: str, count: int = 3) -> int:
with open(path, "w", encoding="utf-8", newline="") as output:
output.write("called")
return count
In Compile, choose Executable → Allow launch arguments → main.process, then choose an output file. The signature shows each default. After building, choose Copy argument help command and paste it into PowerShell or a Linux shell to display the executable’s usage.
py -m pycforge.build process.py --entry-arguments --output process.exe .\process.exe "café 雪 🐍.txt" $LASTEXITCODE .\process.exe --count 12 --path "café 雪 🐍.txt" $LASTEXITCODE
python -m pycforge.build process.py --entry-arguments --output process ./process "café 雪 🐍.txt" echo $? ./process --count 12 --path "café 雪 🐍.txt" echo $?
The build command chooses the sole compatible entry. If several qualify, choose one with --entry main.process. These runs write or replace the example file and return 3 and 12. If the build command cannot find PCFC11, add --compiler and the quoted path shown in Compile.
Use signed 64-bit integer or UTF-8 string literals for defaults. Only omitted arguments use them. --count= is invalid; --path= supplies empty text. Missing required arguments, duplicates and invalid values return 2 before the function runs. Use --help for the signature. For text starting with --, use --path=--help or end option parsing with --.
Verified 0.2.68 supports defaults. 0.2.67 accepts multiple required arguments, 0.2.66 accepts one integer or text/path, 0.2.65 accepts one positional or named integer, and 0.2.64 accepts one positional integer. Earlier verified versions hide argument entry.
Transpile in Runtime mode, open Compile, choose Executable and select Allow one text or path argument. With PCFC11 0.2.68, an undecorated function can take one required positional parameter, either unannotated or annotated as str. The program receives a Runtime string. A path is passed exactly as supplied. Relative paths resolve when the function opens them.
def start(path: str):
with open(path, "r", encoding="utf-8") as handle:
print(handle.read())
return 0
For this example saved as reader.py, use these PowerShell commands with a configured PCFC11 on PATH.
py -m pycforge.build reader.py --runtime-values --entry-arguments --output reader.exe .\reader.exe --path "résumé notes.txt"
On Linux, build with python -m pycforge.build reader.py --runtime-values --entry-arguments --output reader and run ./reader "résumé notes.txt". A sole eligible entry is selected automatically. Use --entry main.start to choose between several entries.
Use --help to display launch syntax. Pass -- --help to supply the literal text. A quoted empty value or --path= supplies an empty string. ASCII parameter names support named values. For other names, use positional input. Invalid encoding or arguments exit with status 2 before program initialization. A Runtime error exits with status 1. Returning None exits with status 0. Integer results outside 0–255 exit with status 255.
In Typed mode, use a function taking one str and returning int. With verified PCFC11 0.2.68, choose Executable, check Allow launch arguments and select your function. The caller supplies the value when starting the built program.
Save this example as save.py. It creates or overwrites the named file with the two characters ok and returns the number of Unicode code points in the supplied name.
def save(path: str) -> int:
with open(path, "w", encoding="utf-8", newline="") as handle:
handle.write("ok")
return len(path)
py -m pycforge.build save.py --text-entry --entry main.save --output save.exe .\save.exe --path "café 雪.txt" $LASTEXITCODE
python -m pycforge.build save.py --text-entry --entry main.save --output save ./save "café 雪.txt" echo $?
Both invocations create café 雪.txt in the working directory and return 10. Add --compiler and the quoted compiler path to the build command when needed. The shell quotes keep the filename together. The program accepts the supplied text, including spaces and Unicode, without expanding or normalizing a path.
For an ASCII parameter named path, use --path VALUE or --path=VALUE. Names are case-sensitive. --path= passes an empty string, even in shells that drop empty quoted arguments. Use -- --help to pass the literal text --help. Bare --help prints usage and exits successfully. For a non-ASCII parameter name, use a positional value or -- VALUE. An unknown option, missing or extra value, malformed UTF-8 on Linux, or invalid UTF-16 on Windows returns 2 before the function runs. An empty string is valid text. The example returns 1 if the supplied file cannot be opened or written.
Use a current Typed conversion and the verified PCFC11 0.2.68 compiler. Retained 0.2.66 supports one integer or text/path argument. Retained 0.2.65 supports positional and named integers. Retained 0.2.64 supports one positional integer. With 0.2.63 or earlier, executable entries take zero arguments. To enable this feature, open Transpile → Build PCFC11… and complete the bundled build. On Windows, setup runs the native checks automatically before activating it.
Save this example as score.py and transpile in Typed mode.
def score(amount: int) -> int:
return amount
In Compile, choose Executable, check Allow launch arguments and select the entry ending in .score. On a smaller screen, scroll through the settings and output. Compile, Cancel Build and the other action buttons stay visible. Save the program as score.exe on Windows or score on Linux. The CLI uses main as the default logical module. If the compiler is outside PATH, add --compiler followed by its quoted executable path.
py -m pycforge.build score.py --integer-entry --entry main.score --output score.exe .\score.exe --amount 42 $LASTEXITCODE
python -m pycforge.build score.py --integer-entry --entry main.score --output score ./score --amount=42 echo $?
Both examples return status 42. For 0.2.65 through 0.2.68, use the exact, case-sensitive ASCII parameter name after two hyphens. Supply its value after a space or an equals sign. For example, --amount -7 and --amount=-7 both pass negative seven. Positional input such as +42 also works. Use positional input for non-ASCII names. Unknown options, repeated options and mixing positional and named values produce a usage error. A bare --help prints usage, including for a parameter named help. The program accepts one decimal integer from -9223372036854775808 through 9223372036854775807. A leading sign and leading zeroes are valid. Use ASCII digits. A missing or extra argument, whitespace inside a value, a fraction, a hexadecimal value or overflow prints the parameter name to standard error and exits with status 2 before the function runs.
Run .\score.exe --help or ./score --help to print usage and the parameter name to standard output and exit successfully. A successful function call returns its result as status 0–255. Any other integer result becomes 255. A Typed file-operation error returns 1. A function may itself return 2, so check standard error when diagnosing input.
Choose Object file for the raw compiled object. Use --kind object-package --output score.zip or Typed object and matching headers (.zip) for the object, matching C headers and pycforge_abi.json. A C caller passes typed parameters directly to the published function. Both object formats build without an executable entry.
For compiler experiments and the original standalone test workflow, extract a separate working copy using the Python environment containing PyCForge, or run from the PyCForge source root:
python -m pycforge.pcfc11 --extract ./compilers
Windows can use py -m pycforge.pcfc11 --extract .\compilers. Extraction verifies the bundled archive's SHA-256, creates compilers/PCFC11-0.2.68 with complete source, headers, licenses and tests, and never executes them. It refuses to merge with an existing folder; choose another parent to make another copy.
The original archive is also present at pycforge/pcfc11/PCFC11-0.2.68-source.zip in the source distribution. Its provenance record identifies the exact release. Historical plans retained in the compiler archive do not replace this manual. The managed IDE route always builds its own pinned copy; use the command-line build service below for a separately built compiler.
Install MSYS2 and UCRT64 GCC separately using MSYS2's instructions. The UCRT64 package is mingw-w64-ucrt-x86_64-gcc. From PowerShell, adjust your MSYS2 path as needed:
cd .\compilers\PCFC11-0.2.68 $env:Path = "C:\msys64\ucrt64\bin;$env:Path" py tools\build.py --cc "C:\msys64\ucrt64\bin\gcc.exe" .\pcfc11.exe --version .\pcfc11.exe -std=c11 -O1 examples\hello.c -o hello.exe .\hello.exe
The PATH assignment applies to this PowerShell session and its children. It makes matching DLLs and helpers available for manual commands. The last command explicitly runs the smoke program. Keep pcfc11.exe beside its entire matching include directory. WSL builds the Linux compiler, not the native Windows compiler.
cd compilers/PCFC11-0.2.68 python tools/build.py --cc /usr/bin/gcc ./pcfc11 --version ./pcfc11 -std=c11 -O1 examples/hello.c -o hello ./hello
Substitute python3 and your GCC path if needed. Keep pcfc11 beside its matching include directory. These source builds need no administrator privileges once prerequisite tools are available.
For app.py containing def start() -> int: return 0, an explicit external-compiler invocation on Windows is:
py -m pycforge.build app.py --entry main.start --compiler-family pcfc11 --compiler "C:\path\PCFC11-0.2.68\pcfc11.exe" --toolchain "C:\msys64\ucrt64\bin\gcc.exe" --output program.exe
On Linux use python, native paths and output such as program. Add --runtime-values for Runtime conversion or --kind object for object output. This explicit command-line route is separate from the IDE's fixed managed slot.
The guided Windows build already runs its focused acceptance checks automatically. The broader standalone workflow below is available for maintainer checks in an independently extracted copy:
bash test-pcfc11.sh
On Windows use MSYS2 UCRT64 or Git Bash with native Windows Python 3.11+. The PowerShell alternative is:
py tools\test_windows.py --cc "C:\msys64\ucrt64\bin\gcc.exe"
The suite rebuilds the compiler and writes logs and a results ZIP under test-results. Running it inside the managed folder would replace the recorded executable and require setup again. Retain the results ZIP even on failure. OpenBLAS and LAPACKE are optional extra qualification, not basic prerequisites. Bundled PyCForge fixtures are historical inputs; test current application programs too. PyCForge's source distribution retains test-windows-gc.ps1 and WINDOWS-GC-TESTING.md for current generated-memory checks.
PCFC11 reports stable codes for classified C errors, optional argument-count facts and related declarations. PCFC11-E0000 means unclassified; message wording is not an API. Use pcfc11 --diagnostic-catalog-json to read the installed compiler inventory. Columns count one-based UTF-8 bytes. A C error location does not automatically identify the corresponding Python expression.
Compiler errors, malformed diagnostics and incomplete output stop publication even if the compiler returns exit code zero. Source mappings are attached only to unambiguous in-bounds points in the generated input. Logs remain available for assembler and linker failures. Compiler diagnostics remain part of PyCForge. SDK reports describe conversion authoring only; historical SDK native reports remain historical evidence.
Driver, input/output, resource and process failures have distinct classified identities. A missing tool is distinguished from an external assembler or linker that reports failure. Token spelling records preserve physical locations behind #line; transformed and synthetic buffers remain explicitly unsuitable for exact source navigation. Build results identify associated source ranges, generated support code and unmapped locations. These associations do not prove a Python defect or authorize an automatic edit.
O2 includes O1 and improves scalar integer array reads and writes on x86-64. For an ordinary update such as a[i] = a[i] * 3u + 17u, the compiler can calculate the element address once and use it for the load and store. For an update such as words[i] += delta, the compiler can add directly to the indexed element when the assignment result is unused. Eligible subtract, AND, OR and XOR updates use the same form. If the program uses the assigned value, the compiler can retain the address in a register and produce the converted result. The optimization checks the base, index conversions and effects within the assignment. PCFC11 can also compare a 32- or 64-bit integer counter in its assigned register and advance it there when the old value is unused. Guarded range steps still test their bound. Qualified accesses and complex expressions keep their established evaluation.
At O1, PCFC11 uses wider moves for ordinary struct and union assignment. It copies exactly the declared object size, including for packed values and odd-sized tails.
O1 can reuse the existing four callee-saved integer registers for eligible values whose lifetimes do not overlap. Complete liveness and parameter-entry checks protect values; excess or unsupported cases retain stack or dedicated-register placement. Calls and address-taking updates remain conservative. O0 and the calling convention are unchanged; performance depends on the program.
Array-parameter bracket qualifiers apply to the adjusted pointer. Both C11 qualifier/static orderings are accepted; static specifies a caller minimum-size contract without automatic runtime length checks. Linux prototype [*] is supported and rejected outside prototype scope. Array elements require complete object types, and VLA alignment follows the element. Windows retains its explicit VLA restriction.
In C parameter lists, earlier parameter names are visible to later bounds. Linux function definitions evaluate variable-length array parameter bounds on entry; Windows retains its explicit VLA restriction. Enumeration types use signed-int compatibility, and conflicting enum or parameter declarations report the earlier declaration location. These rules do not imply complete C11 conformance.
| Problem | Action |
|---|---|
| Missing or changed compiler | Open Build PCFC11, review Python/GCC paths and build. Use Recheck to inspect retained builds. Choose Use verified PCFC11 when offered, or Other C Compilers; retry a failed build only after addressing its reported cause. |
| Wrong Python or GCC | Select native 64-bit tools. Windows requires UCRT64 GCC, not an MSYS compiler or an MSVCRT toolchain. Browse to the actual executable, not a launcher command with arguments. |
| Missing DLL, header or linker | Repair the complete selected toolchain. Do not mix UCRT64 and MSYS files. For manual Windows commands, set the session PATH above. |
| Another operation is using PCFC11 | Wait for it to finish or cancel it in the owning window, then choose Recheck. A stale lock file alone does not hold the operating-system lock. |
| Compile or Continue is disabled | Wait for checking/building to finish. Once the compiler is ready, transpile the current source successfully; edits and conversion errors invalidate old C. Build PCFC11 remains available from the Transpile menu. |
| Build timeout | Inspect the log and tools. Increase the compiler build timeout if the machine needs more time, then explicitly rebuild. |
| Source extraction finds an existing folder | Keep the working copy and choose another parent. Extraction does not replace it. |
| No executable entry or unsupported C feature | A successful transpile may produce callable functions without an executable entry. The dialog explains the missing entry and keeps Compile disabled for Executable output. Select a supported zero-argument entry, use a Typed executable entry with an argument, or choose Object file for functions called from C. Review diagnostics and the compiler README. PCFC11 is not a claim of complete ISO C11 conformance; use another suitable compiler when needed. |