a68: Resolve mode equivalences for imported publicized identifiers.
Algol68 compiler correctly resolves mode equivalences for imported identifiers, fixing a bug in module interaction.
This change addresses a bug in the Algol68 compiler where imported modes from ‘revelations’ were not correctly processed if they were equivalent to standard modes. Due to how these imported identifiers were synthesized with dummy nodes, the compute_derived_modes pass didn’t handle their equivalences, which are normally compared by pointer. The fix ensures that mode equivalences are resolved for these imported identifiers, allowing the compiler to correctly understand and use them, especially when interacting with modules.
In Details
In the Algol68 compiler, imported modes from extract operations on revelations are not directly linked in the parse tree. Instead, stub declarations are created in the symbol table, preventing compute_derived_modes from processing them. When an imported mode is equivalent to a standard mode (e.g., SIZETY compl), and these standard modes are compared by pointer identity, it causes issues. This patch modifies a68_extract_revelation to call a68_resolve_equivalent on imported modes, ensuring that mode equivalences are resolved correctly before compute_derived_modes is invoked, thus…
- mode
- In Algol68, a mode is analogous to a type in other programming languages, defining the structure and interpretation of data.
- revelation
- A mechanism in Algol68 for exporting and importing declarations between modules.
- symbol table
- A data structure used by a compiler to store information about identifiers (variables, functions, types, etc.) encountered in the source code.