Algol68 parser corrects operator argument count check.
Fixed a bug in the Algol68 parser that incorrectly checked the number of arguments for operators.
A bug in the Algol68 compiler’s parser has been fixed, specifically in the check_operator_dec function. This function is responsible for verifying that operators are declared with the correct number of arguments. The fix ensures accurate validation, preventing potential compilation errors related to operator definitions. New test cases have been added to cover the corrected scenarios.
In Details
This commit addresses a bug in the Algol68 parser (a68-parser-taxes.cc) related to operator declarations. The check_operator_dec function incorrectly validated the number of arguments for operator declarations. This fix ensures that the parser accurately checks if an operator declaration adheres to the expected arity, aligning with the Algol68 language specification. New regression tests (error-op-numargs-*.a68) are included to verify the fix.
- Algol68
- A high-level, general-purpose programming language, known for its innovative features like complex data structures and concurrency support.
- parser
- A component of a compiler that takes a stream of tokens from a lexical analyzer and builds a hierarchical structure (like an abstract syntax tree) representing the source code, based on the language's grammar.
- operator declaration
- In Algol68, the process of defining an operator, including its symbol, its type, and the number and types of its operands (arity).
- arity
- The number of arguments or operands that a function, operator, or procedure takes.