# lim-yuna/japyscript architecture

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

- Interactive diagram: https://gitdiagram.com/lim-yuna/japyscript
- Repository: https://github.com/lim-yuna/japyscript

## Overview

JapyScript is a standalone programming language and runtime. The principal workflow is a developer invoking `jpy` to compile `.jpy` source through tokenization, parsing, optional checking, and bytecode emission, then execute it on the VM. The repository also documents a standard library, concurrency, server primitives, package management, formatting/linting, and native bindings. Some of these branches are documented in the README but their implementation wiring was not sampled, so those relationships are not inferred.

Main entry points: [`cli/jpy.py`](https://github.com/lim-yuna/japyscript/blob/main/cli/jpy.py) (CLI), [`vm/machine.py`](https://github.com/lim-yuna/japyscript/blob/main/vm/machine.py) (Virtual Machine), [`compiler/parser.py`](https://github.com/lim-yuna/japyscript/blob/main/compiler/parser.py) (Parser), [`compiler/checker/__init__.py`](https://github.com/lim-yuna/japyscript/blob/main/compiler/checker/__init__.py) (Type Checker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_toolchain["Language Toolchain"]
  node_jpy["CLI<br/>[jpy.py]"]
  node_lexer["Lexer<br/>[lexer.py]"]
  node_tokens["Token Model<br/>[tokens.py]"]
  node_parser["Parser<br/>[parser.py]"]
  node_ast["AST<br/>[ast.py]"]
  node_checker["Type Checker<br/>[__init__.py]"]
  node_type_system["Type Primitives<br/>[types.py]"]
  node_emitter["Bytecode Emitter<br/>[__init__.py]"]
  node_bytecode["Bytecode Format<br/>[bytecode.py]"]
  node_formatter["Formatter<br/>[formatter.py]"]
  node_linter["Linter<br/>[linter.py]"]
end

subgraph group_runtime["Runtime"]
  node_vm["Virtual Machine<br/>[machine.py]"]
  node_scheduler["Async Scheduler<br/>[scheduler.py]"]
end

subgraph group_ecosystem["Language Ecosystem"]
  node_stdlib["Standard Library"]
  node_server["Server Primitives"]
  node_jpm["Package Manager<br/>[jpm.py]"]
end

subgraph group_interop["Native Interop"]
  node_bindings["Native Bindings"]
end

node_developer(("Developer"))

node_developer -->|"invokes"| node_jpy
node_jpy -->|"tokenizes"| node_lexer
node_lexer -->|"emits tokens"| node_tokens
node_jpy -->|"parses"| node_parser
node_parser -->|"consumes"| node_tokens
node_parser -->|"builds"| node_ast
node_jpy -->|"checks"| node_checker
node_checker -->|"checks"| node_ast
node_checker -->|"uses types"| node_type_system
node_jpy -->|"compiles"| node_emitter
node_emitter -->|"walks"| node_ast
node_emitter -->|"produces"| node_bytecode
node_jpy -->|"executes"| node_vm
node_vm -->|"dispatches"| node_bytecode
node_jpy -->|"formats"| node_formatter
node_jpy -.->|"lints"| node_linter
node_vm -.->|"async scheduling"| node_scheduler
node_stdlib -.->|"runs on"| node_vm
node_server -.->|"provides primitives"| node_stdlib
node_developer -->|"manages packages"| node_jpm
node_developer -.->|"integrates native code"| node_bindings

click node_jpy "https://github.com/lim-yuna/japyscript/blob/main/cli/jpy.py"
click node_lexer "https://github.com/lim-yuna/japyscript/blob/main/compiler/lexer.py"
click node_tokens "https://github.com/lim-yuna/japyscript/blob/main/compiler/tokens.py"
click node_parser "https://github.com/lim-yuna/japyscript/blob/main/compiler/parser.py"
click node_ast "https://github.com/lim-yuna/japyscript/blob/main/compiler/ast.py"
click node_checker "https://github.com/lim-yuna/japyscript/blob/main/compiler/checker/__init__.py"
click node_type_system "https://github.com/lim-yuna/japyscript/blob/main/compiler/checker/types.py"
click node_emitter "https://github.com/lim-yuna/japyscript/blob/main/compiler/emitter/__init__.py"
click node_bytecode "https://github.com/lim-yuna/japyscript/blob/main/compiler/emitter/bytecode.py"
click node_formatter "https://github.com/lim-yuna/japyscript/blob/main/cli/formatter.py"
click node_linter "https://github.com/lim-yuna/japyscript/blob/main/cli/linter.py"
click node_vm "https://github.com/lim-yuna/japyscript/blob/main/vm/machine.py"
click node_scheduler "https://github.com/lim-yuna/japyscript/blob/main/vm/scheduler.py"
click node_stdlib "https://github.com/lim-yuna/japyscript/tree/main/stdlib"
click node_server "https://github.com/lim-yuna/japyscript/tree/main/server"
click node_jpm "https://github.com/lim-yuna/japyscript/blob/main/jpm/jpm.py"
click node_bindings "https://github.com/lim-yuna/japyscript/tree/main/bindings"

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_jpy,node_lexer,node_tokens,node_parser,node_ast,node_checker,node_type_system,node_emitter,node_bytecode,node_formatter,node_linter toneBlue
class node_vm,node_scheduler toneAmber
class node_stdlib,node_server,node_jpm toneMint
class node_bindings toneRose
class node_developer toneIndigo
```

## Components

### Language Toolchain

- [CLI](https://github.com/lim-yuna/japyscript/blob/main/cli/jpy.py): `cli/jpy.py`
- [Lexer](https://github.com/lim-yuna/japyscript/blob/main/compiler/lexer.py): `compiler/lexer.py`
- [Token Model](https://github.com/lim-yuna/japyscript/blob/main/compiler/tokens.py): `compiler/tokens.py`
- [Parser](https://github.com/lim-yuna/japyscript/blob/main/compiler/parser.py): `compiler/parser.py`
- [AST](https://github.com/lim-yuna/japyscript/blob/main/compiler/ast.py): `compiler/ast.py`
- [Type Checker](https://github.com/lim-yuna/japyscript/blob/main/compiler/checker/__init__.py): `compiler/checker/__init__.py`
- [Type Primitives](https://github.com/lim-yuna/japyscript/blob/main/compiler/checker/types.py): `compiler/checker/types.py`
- [Bytecode Emitter](https://github.com/lim-yuna/japyscript/blob/main/compiler/emitter/__init__.py): `compiler/emitter/__init__.py`
- [Bytecode Format](https://github.com/lim-yuna/japyscript/blob/main/compiler/emitter/bytecode.py): `compiler/emitter/bytecode.py`
- [Formatter](https://github.com/lim-yuna/japyscript/blob/main/cli/formatter.py): `cli/formatter.py`
- [Linter](https://github.com/lim-yuna/japyscript/blob/main/cli/linter.py): `cli/linter.py`

### Runtime

- [Virtual Machine](https://github.com/lim-yuna/japyscript/blob/main/vm/machine.py): `vm/machine.py`
- [Async Scheduler](https://github.com/lim-yuna/japyscript/blob/main/vm/scheduler.py): `vm/scheduler.py`

### Language Ecosystem

- [Standard Library](https://github.com/lim-yuna/japyscript/tree/main/stdlib): `stdlib`
- [Server Primitives](https://github.com/lim-yuna/japyscript/tree/main/server): `server`
- [Package Manager](https://github.com/lim-yuna/japyscript/blob/main/jpm/jpm.py): `jpm/jpm.py`

### Native Interop

- [Native Bindings](https://github.com/lim-yuna/japyscript/tree/main/bindings): `bindings`

### Other components

- **Developer**

## Connections

- Developer → CLI: invokes (evidence: `README.md`)
- CLI → Lexer: tokenizes (evidence: `cli/jpy.py`)
- Lexer → Token Model: emits tokens (evidence: `compiler/lexer.py`)
- CLI → Parser: parses (evidence: `cli/jpy.py`)
- Parser → Token Model: consumes (evidence: `compiler/parser.py`)
- Parser → AST: builds (evidence: `compiler/parser.py`)
- CLI → Type Checker: checks (evidence: `cli/jpy.py`)
- Type Checker → AST: checks (evidence: `compiler/checker/__init__.py`)
- Type Checker → Type Primitives: uses types (evidence: `compiler/checker/__init__.py`)
- CLI → Bytecode Emitter: compiles (evidence: `cli/jpy.py`)
- Bytecode Emitter → AST: walks (evidence: `compiler/emitter/__init__.py`)
- Bytecode Emitter → Bytecode Format: produces (evidence: `compiler/emitter/__init__.py`)
- CLI → Virtual Machine: executes (evidence: `cli/jpy.py`)
- Virtual Machine → Bytecode Format: dispatches (evidence: `vm/machine.py`)
- CLI → Formatter: formats (evidence: `README.md`)
- CLI → Linter: lints
- Virtual Machine → Async Scheduler: async scheduling
- Standard Library → Virtual Machine: runs on (evidence: `README.md`)
- Server Primitives → Standard Library: provides primitives (evidence: `README.md`)
- Developer → Package Manager: manages packages (evidence: `README.md`)
- Developer → Native Bindings: integrates native code (evidence: `README.md`)
