blaise/docs
Graeme Geldenhuys 1a5a881d6c feat(semantic): reserve module names as identifiers
The program/unit's own name and the names of directly used units can
no longer be redeclared by top-level declarations, matching FPC and
Delphi (Duplicate identifier / E2004).  Previously the module name was
stored on the AST node and never entered the symbol table, so
'program P; var P: Integer;' compiled by accident of omission.

The semantic pass plants skModule marker symbols in the scopes that
receive top-level declarations (global + program-block scope for
programs, unit scope for units); the ordinary duplicate check on
TSymbolTable.Define then rejects redeclarations.  Lookup treats a
marker hit as unresolvable, so the reserved name is not a value and
inner scopes can still shadow it, as in FPC.  The const paths get an
explicit marker check because their Define-failure branch otherwise
tolerates the clash silently (cross-unit const shadowing).

One deliberate divergence: FPC accepts a procedure named after the
program (an accident of its overload machinery); Blaise rejects all
declaration forms uniformly.

Grammar is unchanged — this is a name-resolution rule, not syntax —
so grammar.ebnf is untouched; the decision is recorded in
language-rationale.adoc.  44 test programs named 'program P' that also
declared an identifier P are renamed to 'program Prg'.

Closes #84
2026-06-11 23:51:11 +01:00
..
benchmark.txt docs(benchmark): add QBE 1.3 measurement entry 2026-06-02 17:17:54 +01:00
bif-format.adoc docs: .bif file format reference 2026-06-03 19:40:08 +01:00
design.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00
extending-ast.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00
future-improvements.adoc feat(debug): link --debug-opdf binaries as PIE 2026-06-11 15:43:02 +01:00
grammar.ebnf feat: interface properties 2026-06-11 11:04:47 +01:00
language-rationale.adoc feat(semantic): reserve module names as identifiers 2026-06-11 23:51:11 +01:00
name-mangling.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00
native-const-arg-arc-port.adoc docs: native const-arg ARC port design — mark implemented 2026-06-11 07:36:13 +01:00
testing-strategy.adoc refactor: rename uCodeGen/uCodeGenQBE to blaise.codegen/blaise.codegen.qbe 2026-06-10 12:12:14 +01:00