blaise/docs
Graeme Geldenhuys b34bfc574d Implement Phase 3 generics monomorphization (Delphi syntax)
Parse generic class declarations (`TBox<T>`) as TGenericTypeDef nodes.
Introduce one-token parser lookahead to disambiguate `<` in type
positions vs. comparison operators.

Demand-driven instantiation: when a var declaration references
`TBox<Integer>`, InstantiateGeneric clones the class AST with type-param
substitution, resolves all field/method types, analyses method bodies
with the concrete class type in scope, and registers the instance in
TProgram.GenericInstances.  Instantiated type symbols are defined in
the global scope so they survive inner scope pops.

Codegen emits typeinfo, vtable, and method bodies for each generic
instance using QBEMangle (`TBox<Integer>` → `TBox_Integer`).

19 new tests in cp.test.generics cover parser, semantic, and codegen
paths.  All 513 tests pass.
2026-04-21 23:02:23 +01:00
..
design.adoc Implement Phase 3 generics monomorphization (Delphi syntax) 2026-04-21 23:02:23 +01:00
grammar.ebnf Add class instance methods (procedure, inline body, Self, method calls) 2026-04-20 19:42:09 +01:00