GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
cobol

COBOL: Restrict CDF reserved words to CDF parsing

COBOL parser now correctly restricts CDF reserved words to when they are used in CDF contexts.

Reserved words specific to the COBOL Deployment Facility (CDF) files, such as PARAMETER, are now correctly recognized only within CDF parsing contexts. Previously, these words were incorrectly treated as reserved during normal parsing, leading to potential errors. This change ensures accurate parsing of CDF-related constructs.

In Details

This commit adjusts the COBOL lexer (scan.l) to ensure that tokens like PARAMETER are only treated as reserved words when the parser is in a CDF-specific state. Previously, these CDF reserved words were being captured during general parsing, causing issues. Moving these tokens to the cdf_state start condition resolves this, ensuring correct parsing of CDF files and preventing misinterpretation of valid CDF keywords as general COBOL syntax errors.

For Context
CDF
COBOL Deployment Facility, a set of standards or tools related to deploying COBOL applications. Specific reserved words may be associated with its configuration or definition files.
reserved word
A word that has a special meaning in a programming language or a specific file format and cannot be used as an identifier (e.g., variable name).
parser
A component of a compiler that analyzes the syntactic structure of source code, breaking it down into smaller components according to the language's grammar rules.
lexer
Also known as a scanner, it's the component that reads the source code character by character and groups them into meaningful tokens.
start condition
Used in lexer generators (like flex/lex) to define different scanning states. Tokens defined within a specific start condition are only recognized when that state is active.
Filed Under: cobolparserlexerlanguage support