# bromanprjkt/sundalang architecture

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

- Interactive diagram: https://gitdiagram.com/bromanprjkt/sundalang
- Repository: https://github.com/bromanprjkt/sundalang

## Overview

SundaLang is a Go interpreter for a Pandeglang Sundanese programming language. Users run source files or inline code through the CLI, or enter the persistent REPL; source is tokenized, parsed into an AST, then evaluated. The runtime also supports language features such as functions, collections, error handling, file I/O, and built-ins. The excerpts show CLI construction of the lexer and parser and the REPL’s evaluation loop; some batch evaluation details are omitted, so that connection is marked unverified.

Main entry points: [`cmd/sundalang.go`](https://github.com/bromanprjkt/sundalang/blob/main/cmd/sundalang.go) (CLI commands), [`pkg/sundalang/repl.go`](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/repl.go) (REPL), [`pkg/sundalang/parser.go`](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/parser.go) (Parser), [`pkg/sundalang/evaluator.go`](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go) (Evaluator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command line"]
  node_cli["CLI commands<br/>[sundalang.go]"]
  node_file["Source file"]
end

subgraph group_frontend["Language frontend"]
  node_lexer["Lexer<br/>[lexer.go]"]
  node_tokens["Token definitions<br/>[token.go]"]
  node_parser["Parser<br/>[parser.go]"]
  node_ast["Syntax tree<br/>[ast.go]"]
end

subgraph group_runtime["Interpreter runtime"]
  node_evaluator["Evaluator<br/>[evaluator.go]"]
  node_environment["Runtime environment<br/>[evaluator.go]"]
  node_builtins["Built-ins and I/O<br/>[evaluator.go]"]
end

subgraph group_interaction["Interactive mode"]
  node_repl["REPL<br/>[repl.go]"]
end

node_user(("Programmer"))
node_terminal(("Terminal user"))
node_host[("Host filesystem")]

node_user -->|"invokes"| node_cli
node_file -->|"provides source"| node_cli
node_cli -->|"creates"| node_lexer
node_cli -->|"creates"| node_parser
node_lexer -->|"emits"| node_tokens
node_parser -->|"requests tokens"| node_lexer
node_parser -.->|"builds"| node_ast
node_cli -.->|"evaluates source"| node_evaluator
node_repl -->|"creates"| node_lexer
node_repl -->|"parses input"| node_parser
node_repl -->|"evaluates program"| node_evaluator
node_evaluator -->|"resolves bindings"| node_environment
node_evaluator -->|"dispatches calls"| node_builtins
node_builtins -->|"reads and writes files"| node_host
node_terminal -->|"enters"| node_repl

click node_cli "https://github.com/bromanprjkt/sundalang/blob/main/cmd/sundalang.go"
click node_lexer "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/lexer.go"
click node_tokens "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/token.go"
click node_parser "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/parser.go"
click node_ast "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/ast.go"
click node_evaluator "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go"
click node_environment "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go"
click node_builtins "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go"
click node_repl "https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/repl.go"

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_cli,node_file,node_terminal toneBlue
class node_lexer,node_tokens,node_parser,node_ast,node_host toneAmber
class node_evaluator,node_environment,node_builtins toneMint
class node_repl toneRose
class node_user toneIndigo
```

## Components

### Command line

- [CLI commands](https://github.com/bromanprjkt/sundalang/blob/main/cmd/sundalang.go): `cmd/sundalang.go`
- **Source file**

### Language frontend

- [Lexer](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/lexer.go): `pkg/sundalang/lexer.go`
- [Token definitions](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/token.go): `pkg/sundalang/token.go`
- [Parser](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/parser.go): `pkg/sundalang/parser.go`
- [Syntax tree](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/ast.go): `pkg/sundalang/ast.go`

### Interpreter runtime

- [Evaluator](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go): `pkg/sundalang/evaluator.go`
- [Runtime environment](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go): `pkg/sundalang/evaluator.go`
- [Built-ins and I/O](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/evaluator.go): `pkg/sundalang/evaluator.go`

### Interactive mode

- [REPL](https://github.com/bromanprjkt/sundalang/blob/main/pkg/sundalang/repl.go): `pkg/sundalang/repl.go`

### Other components

- **Programmer**
- **Terminal user**
- **Host filesystem**

## Connections

- Programmer → CLI commands: invokes (evidence: `README.md`)
- Source file → CLI commands: provides source (evidence: `README.md`)
- CLI commands → Lexer: creates (evidence: `cmd/sundalang.go`)
- CLI commands → Parser: creates (evidence: `cmd/sundalang.go`)
- Lexer → Token definitions: emits (evidence: `pkg/sundalang/lexer.go`)
- Parser → Lexer: requests tokens (evidence: `pkg/sundalang/parser.go`)
- Parser → Syntax tree: builds
- CLI commands → Evaluator: evaluates source
- REPL → Lexer: creates (evidence: `pkg/sundalang/repl.go`)
- REPL → Parser: parses input (evidence: `pkg/sundalang/repl.go`)
- REPL → Evaluator: evaluates program (evidence: `pkg/sundalang/repl.go`)
- Evaluator → Runtime environment: resolves bindings (evidence: `pkg/sundalang/evaluator.go`)
- Evaluator → Built-ins and I/O: dispatches calls (evidence: `pkg/sundalang/evaluator.go`)
- Built-ins and I/O → Host filesystem: reads and writes files (evidence: `pkg/sundalang/evaluator.go`)
- Terminal user → REPL: enters (evidence: `README.md`)
