COBOL Parsers (Front Ends)

Our COBOL parsers (front ends) enable the construction of COBOL custom compilers, analysis tools, and source transformation tools. They are a member of SD's family of language front ends, based on first-class infrastructure (DMS) for implementing such custom tools. The COBOL front ends include:

  • Lexical analysis including ASCII, ISO 8859-1 and Unicode (plus EBCDIC for IBM dialects)
    • Conversion of literal values (numbers, escaped strings) into native values to enable easy computation over literal values
  • Explicit grammars directly implement:
    • the ANSI COBOL 85 standard
    • IBM VS II
    • IBM z/OS Enterprise COBOL (Version 3.4, 4.2, 5.0 and 6.0) including DataCom directives
    • MicroFocus COBOL
    • MicroFocus AcuCOBOL
    • HP-NonStop/Tandem COBOL and SCOBOL
    • Fujitsu NetCOBOL
    • AS/400 COBOL
  • Preprocessor support
    • Controllable COPYLIB directory paths
    • Option to either expand COPY statements or retain them intact
  • Automatic construction of complete abstract syntax tree
    • Capture and retain comments and formats (shape) of literal values
    • Ability to parse large systems of files into same workspace, enabling interprocedural and cross-file analysis/transformation
    • Ability to parse different languages into same workspace, enabling cross-language analysis/transformation
    • Retains EXEC SQL code in syntax tree
  • Facilities to process syntax trees
    • Complete procedural API to visit/query/update/construct/print syntax trees
    • Source regeneration by prettyprinting and/or fidelity printing of syntax trees with comments and lexical formats; COPYLIB content is replaced by original COPY statement.
    • Automatically generated source-to-source transformation system
    • Ability to define custom attribute-grammar-based analyzers
  • Name and Type resolution
    • Type representation system for all COBOL types defined
    • All identifiers resolved to their COBOL-defined type and stored in symbol tables
    • Ability to condition transforms on identifier type
    • Abilility to visit/query/update symbol tables
  • Control flow graph extraction
    • Constructed for each program and subroutine definition
    • Ties control flow nodes to ASTs
    • Computes Control Dependences (Sample control flow graph)
    • Computes Post-dominators
    • Computes Region Graph
    • Constructs (paragraph) call tree and determines subroutines determined by PERFORMs
  • Data flow graph extraction
  • Available as source code to enable complete customization
    • Means to manage multiple language dialects with highly shared common core
  • Robustness due to careful testing and application across many customers

Many of these facilities come as a consistent consequence of the front end being built on top of DMS.

Here are some sample tools (many offered by SD as products) built using the COBOL front end:

For IBM mainframes, SD also offers:

  • HLASM parser (front end)
  • JCL parser (front end)
  • PL/1 parser (front end)

Your organization may use DMS with the COBOL front end to implement and deploy your own custom tools. The sample tools can be obtained in source form as part of the COBOL front end for customization. Semantic Designs is also willing to build custom tools under contract.

SD also provides a variety of off-the-shelf COBOL tools.

For more information:    Follow us at Twitter: @SemanticDesigns

COBOL Parser
Front End