Files
ViperC/App/lib/core/CompilerFactory.vp
T

20 lines
795 B
Plaintext

import t, c
import memhub
# ============================================================
# CompilerFactory - 编译器结构体工厂(对齐 TPC Translator 装配模式)
# ============================================================
@t.NoVTable
class CompilerFactory:
"""编译器结构体工厂(持有主池/永久池等共享对象)"""
Pool: rowptr[memhub.MemBuddy] # 主内存池(瞬时数据,mark/reset 回收)
PermPool: rowptr[memhub.MemBuddy] # 永久内存池(持久数据,从不 reset)
def __init__(self, pool: rowptr[memhub.MemBuddy], perm_pool: rowptr[memhub.MemBuddy]):
if self is None: return
self.Pool = pool
self.PermPool = perm_pool
# 全局工厂单例
factory: rowptr[CompilerFactory] = None