# mikefultondev/jclparser architecture

> Architecture diagram of the GitHub repository mikefultondev/jclparser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mikefultondev/jclparser
- Repository: https://github.com/mikefultondev/jclparser

## Overview

jcl2jcl is a command-line JCL parser and normalizer. The principal workflow accepts input and output options, scans JCL into an in-memory statement structure, then regenerates JCL; the README also identifies walking the parse tree for analysis as the broader parser use case. Scanner excerpts show statement dispatch and handling of parameters and inline data, while the message module supplies diagnostics. The scanner-to-generator data handoff is implied by their shared program state, but is not directly shown in the excerpts, so that edge is marked unverified.

Main entry points: [`src/jcl2jcl.c`](https://github.com/mikefultondev/jclparser/blob/main/src/jcl2jcl.c) (CLI workflow), [`src/scanjcl.c`](https://github.com/mikefultondev/jclparser/blob/main/src/scanjcl.c) (JCL scanner), [`src/genjcl.c`](https://github.com/mikefultondev/jclparser/blob/main/src/genjcl.c) (JCL generator), [`src/jclargs.c`](https://github.com/mikefultondev/jclparser/blob/main/src/jclargs.c) (Option parsing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command line"]
  node_main["CLI workflow<br/>[jcl2jcl.c]"]
  node_args["Option parsing<br/>[jclargs.c]"]
end

subgraph group_parse["JCL parsing"]
  node_scanner["JCL scanner<br/>[scanjcl.c]"]
  node_parse_tree["Statement tree<br/>[scanjcl.c]"]
end

subgraph group_output["Generation and diagnostics"]
  node_generator["JCL generator<br/>[genjcl.c]"]
  node_messages["Messages and help<br/>[jclmsgs.c]"]
end

node_user(("Developer"))
node_jcl_input["JCL input"]
node_jcl_output["Generated JCL"]

node_user -->|"runs command"| node_main
node_main -->|"processes options"| node_args
node_args -->|"reports errors"| node_messages
node_main -->|"scans input"| node_scanner
node_jcl_input -.->|"supplies JCL"| node_scanner
node_scanner -->|"builds statements"| node_parse_tree
node_scanner -.->|"passes parse tree"| node_generator
node_main -->|"generates JCL"| node_generator
node_generator -->|"writes JCL"| node_jcl_output
node_main -->|"prints help"| node_messages

click node_main "https://github.com/mikefultondev/jclparser/blob/main/src/jcl2jcl.c"
click node_args "https://github.com/mikefultondev/jclparser/blob/main/src/jclargs.c"
click node_scanner "https://github.com/mikefultondev/jclparser/blob/main/src/scanjcl.c"
click node_parse_tree "https://github.com/mikefultondev/jclparser/blob/main/src/scanjcl.c"
click node_generator "https://github.com/mikefultondev/jclparser/blob/main/src/genjcl.c"
click node_messages "https://github.com/mikefultondev/jclparser/blob/main/src/jclmsgs.c"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main,node_args toneBlue
class node_scanner,node_parse_tree toneAmber
class node_generator,node_messages toneMint
class node_user,node_jcl_input,node_jcl_output toneIndigo
```

## Components

### Command line

- [CLI workflow](https://github.com/mikefultondev/jclparser/blob/main/src/jcl2jcl.c): `src/jcl2jcl.c`
- [Option parsing](https://github.com/mikefultondev/jclparser/blob/main/src/jclargs.c): `src/jclargs.c`

### JCL parsing

- [JCL scanner](https://github.com/mikefultondev/jclparser/blob/main/src/scanjcl.c): `src/scanjcl.c`
- [Statement tree](https://github.com/mikefultondev/jclparser/blob/main/src/scanjcl.c): `src/scanjcl.c`

### Generation and diagnostics

- [JCL generator](https://github.com/mikefultondev/jclparser/blob/main/src/genjcl.c): `src/genjcl.c`
- [Messages and help](https://github.com/mikefultondev/jclparser/blob/main/src/jclmsgs.c): `src/jclmsgs.c`

### Other components

- **Developer**
- **JCL input**
- **Generated JCL**

## Connections

- Developer → CLI workflow: runs command (evidence: `README.md`)
- CLI workflow → Option parsing: processes options (evidence: `src/jcl2jcl.c`)
- Option parsing → Messages and help: reports errors (evidence: `src/jclargs.c`)
- CLI workflow → JCL scanner: scans input (evidence: `src/jcl2jcl.c`)
- JCL input → JCL scanner: supplies JCL
- JCL scanner → Statement tree: builds statements (evidence: `src/scanjcl.c`)
- JCL scanner → JCL generator: passes parse tree
- CLI workflow → JCL generator: generates JCL (evidence: `src/jcl2jcl.c`)
- JCL generator → Generated JCL: writes JCL (evidence: `src/genjcl.c`)
- CLI workflow → Messages and help: prints help (evidence: `src/jcl2jcl.c`)
