Improve Algol68 location tracking.
Algol68 parser now creates more accurate source code location information.
This commit enhances the Algol68 compiler’s ability to track source code locations. It introduces a location_t structure to precisely capture the span of text associated with a parsed node, with the caret pointing to the start of that text. This improves the accuracy of error reporting and debugging information by providing more precise references to the original source code.
In Details
The algol68 frontend's source location tracking has been improved by modifying a68_get_node_location in a68-parser.cc. Instead of just a line number, it now returns a location_t that precisely covers the character span of the AST node in the source file, with the caret positioned at the start of the text. This change aims to provide more granular and accurate source mapping for diagnostics and debugging.
- location tracking
- The process by which a compiler records the exact position (file, line, column) in the source code corresponding to a particular part of the abstract syntax tree or intermediate representation. This is crucial for error reporting and debugging.
- Algol68
- A powerful, early high-level programming language known for its complex syntax and features.
- AST node
- A node in the Abstract Syntax Tree, which is a hierarchical representation of the source code's structure.
- caret
- A cursor or marker indicating a specific position within text, often used in development tools to show where an error occurred or where input is being entered.