a68: Introduce parser pass for static properties
New parser pass in Algol 68 front-end computes 'origin' and 'access' static properties for optimizations.
The Algol 68 front-end now includes a new parser pass to compute static properties of value-yielding constructs. These properties, ‘origin’ and ‘access’, track the original value and its access context, respectively. This information will be used by the lowerer pass to implement optimizations such as avoiding unnecessary copies.
In Details
A new pass, a68_sprops, has been introduced in the Algol 68 parser (a68-parser.cc). This pass computes and annotates AST nodes with static properties: origin (tracking transformations and dereferencing) and access (describing how a value will be accessed after lowering). These properties are stored in the NODE_T structure and are intended to guide optimizations in the lowerer pass, such as eliminating redundant copies and implementing other optimizations based on value provenance and usage.
- Algol 68
- A powerful, high-level programming language known for its complex syntax and strong typing. GCC has a front-end for it.
- Parser
- A component of a compiler that takes a stream of tokens (from a lexer) and builds a hierarchical structure, typically an Abstract Syntax Tree (AST), representing the source code's grammatical structure.
- Static Properties
- Information about a program's constructs that can be determined at compile time without executing the code. In this context, 'origin' and 'access' provide compile-time insights into data value provenance and usage.
- Lowerer Pass
- A compiler pass that translates an intermediate representation (IR) or an AST into a lower-level IR or machine code. In this case, it translates Algol 68 constructs into a form suitable for further optimization or code generation.