CONVERSION REFERENCE
PyCForge admits fixed, local data shapes whose capacity, representation, access, and lifetime can be proved before C is rendered.
Lists, tuples, dictionaries, and admitted sets are function-local, fixed, automatic-storage conversion forms. Capacity is 1–64 elements. A binding is assigned exactly once directly in a function body and may be used only through a proved operation documented below.
def pick() -> int:
values = [10, 20, 30]
return values[-1]
bool, int, float, or
str.def is_priority(value: int) -> bool:
priorities = {1, 4, 9}
return value in priorities
def is_other(value: int) -> bool:
priorities = {1, 4, 9}
return value not in priorities
An admitted set is one directly assigned local literal containing 1–64
unique, homogeneous direct int, finite float, or
bool literals. PyCForge proves that set order cannot be observed,
then lowers storage to a read-only fixed automatic C array.
in and not in are supported only with the set's
direct local name as the single comparator.not in negates that result once.Empty sets, set comprehensions, duplicate elements,
strings, heterogeneous or computed elements, inline membership sets,
indexing, iteration, methods, mutation, aliasing, rebinding, passing, return,
and escape reject. Set iteration is deliberately excluded because Python set
order is not a portable observable order; it reports PYC3412.
Set indexing reports PYC3411.
def lookup() -> int:
values = {'low': 1, 'high': 2}
return values['high']
int or str values with
one homogeneous key representation.Rejected forms include empty or oversized containers, heterogeneous or nested containers, comprehensions, generator expressions, unpacking, duplicate dictionary keys, dynamic indexing, element mutation, container methods, rebinding, aliasing, passing, returning, or escape. The set-specific boundaries above are additional and intentional.
A deliberately narrow top-level class shape becomes an inline automatic C
record. Each record has 1–64 ordered int, float, or
bool fields, followed by exactly one structural
__init__.
class Point:
x: int
y: int
def __init__(self, x: int, y: int) -> None:
self.x = x
self.y = y
def sum_point(left: int, right: int) -> int:
point = Point(left, right)
return point.x + point.y
__init__.self.field = parameter assignments match every field exactly.Other methods, inheritance, decorators, class-level values, dynamic or string fields, mutation after construction, rebinding, copying, aliasing, method calls, passing or returning records, storing records in containers, importing records, and cross-module record use reject.