按 wiki/新规范:注释只讲作用、不掺杂历史原因、避免超长、尽可能英文(含三引号 __doc__)。全文 79 个 .vp:# 注释 16269 行(中文 13808)与 docstring(中文 1381 处)全部改英文;超 2 行的注释块(2093)与 docstring(397)全部压到 2 行。运行时可见文本未动(fatal_error/VLogger 的中文报错文案、stdio.printf 的横幅格式串)。校验:屏蔽注释与三引号后逐行比对各文件代码骨架,0 漂移。验证:自举重建 153.48s 通过(跨模块内联完成);TPV 顺序回归 77/77 全通过。
33 lines
1.2 KiB
Plaintext
33 lines
1.2 KiB
Plaintext
import t, c
|
|
import memhub
|
|
|
|
|
|
# CompilerFactory - compiler struct factory (aligned with TPC Translator assembly).
|
|
novirtual class CompilerFactory:
|
|
"""Compiler struct factory holding shared objects such as the main and permanent pools."""
|
|
Pool: memhub.MemBuddy* # Main memory pool (transient data; reclaimed by mark/reset)
|
|
PermPool: memhub.MemBuddy* # Permanent memory pool (persistent data; never reset)
|
|
|
|
# ---- REnum variant registry (compile-time singleton; same lifetime as perm_pool struct entries)----
|
|
RenumClassNames: sizet*
|
|
RenumClassVariantCounts: sizet*
|
|
RenumVariantNames: sizet*
|
|
RenumVariantTags: sizet*
|
|
RenumClassCount: int
|
|
|
|
# ---- REnum variant field alias table (same lifetime; _bind_variant_fields resolves real field types)----
|
|
RenumAliasClass: sizet*
|
|
RenumAliasField: sizet*
|
|
RenumAliasIndex: sizet*
|
|
RenumAliasTy: sizet*
|
|
RenumAliasVariant: sizet*
|
|
RenumAliasCount: int
|
|
|
|
def __init__(self, pool: memhub.MemBuddy*, perm_pool: memhub.MemBuddy*):
|
|
if self is None: return
|
|
self.Pool = pool
|
|
self.PermPool = perm_pool
|
|
|
|
# Global factory singleton
|
|
factory: CompilerFactory* = None
|