Cobol compiler adds GnuCOBOL compatibility features.
Cobol compiler gains GnuCOBOL compatibility features, including new hexadecimal notation and dialect-specific keywords.
This update enhances the Cobol compiler’s compatibility with GnuCOBOL by introducing several features. It now supports hexadecimal numeric notation (e.g., h'41' for 65) under the -dialect gnu option and recognizes COBOL-WORDS for intrinsic functions. The changes also include finer distinctions for dialect options and improvements to handling REDEFINES tables and potential undefined behavior in literal subscript out-of-bounds cases.
In Details
The cobol front-end has been extended to support GnuCOBOL compatibility features. Key changes include a new lexical rule in scan.l for hexadecimal numeric notation (e.g., h'...'), and parse.y introduces dialect_words_set to manage per-dialect keywords for intrinsic functions. symbols.cc refactors dimensions to support a REDEFINES table, and util.cc replaces a potentially UB-prone literal_subscript_oob with a new hex2numstr function. The compiler now also handles Whex-numeric and Wcontent-expr options more broadly across dialects.
- GnuCOBOL
- An open-source compiler that implements the COBOL language, aiming for compatibility with various COBOL standards and other COBOL compilers.
- hexadecimal numeric notation
- A way to represent numbers using base-16, where digits range from 0-9 and A-F. In this context, it refers to a specific syntax for entering hexadecimal values in COBOL source code.
- COBOL-WORDS
- A mechanism within COBOL to recognize specific keywords, often associated with intrinsic functions or dialect-specific features, allowing for more flexible and compatible language parsing.
- REDEFINES
- A COBOL clause that allows multiple data items to occupy the same memory space. This enables different interpretations or structures of the same data.
- UB (Undefined Behavior)
- Behavior that results from a C++ or C program that violates memory safety or other fundamental rules, leading to unpredictable results that can vary between compilers, platforms, and executions.