# dipeshkant0/flex-bison-c-parser architecture

> Architecture diagram of the GitHub repository dipeshkant0/flex-bison-c-parser, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dipeshkant0/flex-bison-c-parser
- Repository: https://github.com/dipeshkant0/flex-bison-c-parser

## Overview

This repository is a small C-like language compiler: source input is tokenized and parsed into an AST, whose operations can be evaluated and whose tree is printed. The README describes semantic analysis, but the parser and lexer implementations were not sampled, so their detailed behavior and call relationships are not verified; documented relationships are cited to the README.

Main entry points: [`src/ast.c`](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.c) (AST construction and evaluation), [`src/main.c`](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/main.c) (Compiler entry), [`src/parser.y`](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/parser.y) (Syntax parsing), [`src/ast.h`](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.h) (AST definitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_front_end["Front end"]
  node_lexer["Lexical analysis<br/>[lexer.l]"]
  node_parser["Syntax parsing<br/>[parser.y]"]
end

subgraph group_ast["AST and semantics"]
  node_ast_types["AST definitions<br/>[ast.h]"]
  node_ast_ops["AST construction and evaluation<br/>[ast.c]"]
  node_semantic["Semantic analysis"]
end

subgraph group_runtime["Compiler runtime"]
  node_entry["Compiler entry<br/>[main.c]"]
  node_tree_output["AST tree output<br/>[ast.c]"]
end

node_source["Source input"]

node_source -->|"provides input"| node_entry
node_entry -->|"starts parsing"| node_parser
node_lexer -.->|"supplies tokens"| node_parser
node_parser -.->|"builds AST"| node_ast_ops
node_ast_ops -->|"uses definitions"| node_ast_types
node_ast_ops -.->|"supports analysis"| node_semantic
node_entry -->|"prints tree"| node_tree_output
node_tree_output -->|"traverses nodes"| node_ast_types

click node_lexer "https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/lexer.l"
click node_parser "https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/parser.y"
click node_ast_types "https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.h"
click node_ast_ops "https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.c"
click node_semantic "https://github.com/dipeshkant0/flex-bison-c-parser/tree/main/src"
click node_entry "https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/main.c"
click node_tree_output "https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.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_lexer,node_parser toneBlue
class node_ast_types,node_ast_ops,node_semantic toneAmber
class node_entry,node_tree_output toneMint
class node_source toneIndigo
```

## Components

### Front end

- [Lexical analysis](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/lexer.l): `src/lexer.l`
- [Syntax parsing](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/parser.y): `src/parser.y`

### AST and semantics

- [AST definitions](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.h): `src/ast.h`
- [AST construction and evaluation](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.c): `src/ast.c`
- [Semantic analysis](https://github.com/dipeshkant0/flex-bison-c-parser/tree/main/src): `src`

### Compiler runtime

- [Compiler entry](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/main.c): `src/main.c`
- [AST tree output](https://github.com/dipeshkant0/flex-bison-c-parser/blob/main/src/ast.c): `src/ast.c`

### Other components

- **Source input**

## Connections

- Source input → Compiler entry: provides input (evidence: `README.md`)
- Compiler entry → Syntax parsing: starts parsing (evidence: `src/main.c`)
- Lexical analysis → Syntax parsing: supplies tokens (evidence: `README.md`)
- Syntax parsing → AST construction and evaluation: builds AST (evidence: `README.md`)
- AST construction and evaluation → AST definitions: uses definitions (evidence: `src/ast.c`)
- AST construction and evaluation → Semantic analysis: supports analysis (evidence: `README.md`)
- Compiler entry → AST tree output: prints tree (evidence: `src/main.c`)
- AST tree output → AST definitions: traverses nodes (evidence: `src/ast.c`)
