# tcode-motion/techscript architecture

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

- Interactive diagram: https://gitdiagram.com/tcode-motion/techscript
- Repository: https://github.com/tcode-motion/techscript

## Overview

TechScript is a human-readable language and integrated development toolchain. The principal workflow starts with a developer invoking `tsc` on source or a project, proceeds through compilation and a selected execution target, and produces program output or a native executable. The repository also provides project/package workflows, language tooling, and a broad standard library. The README documents the major compiler stages; sampled sources confirm CLI pipeline and optimization orchestration. Some connections for unsampled subsystems are shown only where the README documents them.

Main entry points: [`cli/src/pipeline.rs`](https://github.com/tcode-motion/techscript/blob/main/cli/src/pipeline.rs) (Compiler Pipeline), [`cli/src/main.rs`](https://github.com/tcode-motion/techscript/blob/main/cli/src/main.rs) (tsc Driver), [`cli/src/commands/build.rs`](https://github.com/tcode-motion/techscript/blob/main/cli/src/commands/build.rs) (Build and Check), [`runtime/runtime/src/context.rs`](https://github.com/tcode-motion/techscript/blob/main/runtime/runtime/src/context.rs) (Runtime Services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI and Projects"]
  node_tsc["tsc Driver<br/>[main.rs]"]
  node_project["Project Management<br/>[project.rs]"]
  node_config["Build Configuration<br/>[config.rs]"]
  node_build["Build and Check<br/>[build.rs]"]
  node_pipeline["Compiler Pipeline<br/>[pipeline.rs]"]
  node_cache[("Incremental Cache<br/>[cache.rs]")]
  node_artifacts["Artifact Manager<br/>[artifacts.rs]"]
  node_diagnostics["Diagnostics<br/>[diagnostics.rs]"]
  node_events["Compilation Events<br/>[events.rs]"]
  node_support["Build Support<br/>[scheduler.rs]"]
end

subgraph group_front["Language Frontend"]
  node_lexer["Lexer<br/>[lib.rs]"]
  node_parser["Parser and AST<br/>[parser.rs]"]
  node_semantic["Semantic Analysis<br/>[pipeline.rs]"]
  node_resolver["Module Resolver<br/>[lib.rs]"]
end

subgraph group_compile["Compilation Backends"]
  node_optimizer["IR Optimization<br/>[pipeline.rs]"]
  node_ir["IR Lowering<br/>[lowering.rs]"]
  node_bytecode["Bytecode Backend<br/>[lowering.rs]"]
  node_llvm["LLVM Backend<br/>[codegen.rs]"]
end

subgraph group_runtime["Runtime"]
  node_vm["Bytecode VM<br/>[executor.rs]"]
  node_interpreter["Tree Interpreter<br/>[interpreter.rs]"]
  node_runtime_services["Runtime Services<br/>[context.rs]"]
  node_stdlib["Standard Library<br/>[lib.rs]"]
end

subgraph group_tools["Developer Tools"]
  node_formatter["Formatter<br/>[lib.rs]"]
  node_linter["Linter and Migrator<br/>[lib.rs]"]
  node_lsp["Language Server<br/>[lib.rs]"]
  node_packages["Package Manager<br/>[lib.rs]"]
  node_vscode["VS Code Extension<br/>[extension.js]"]
end

node_developer(("Developer"))
node_source["TechScript Source"]
node_manifest["Project Manifest"]
node_output(("Program Output"))

node_developer -->|"invokes"| node_tsc
node_source -->|"provides source"| node_tsc
node_manifest -->|"provides project"| node_tsc
node_tsc -->|"dispatches commands"| node_build
node_build -->|"loads settings"| node_config
node_build -->|"loads project"| node_project
node_build -->|"compiles through"| node_pipeline
node_pipeline -->|"tokenizes"| node_lexer
node_pipeline -->|"parses"| node_parser
node_pipeline -->|"validates"| node_semantic
node_pipeline -->|"resolves modules"| node_resolver
node_pipeline -->|"lowers to IR"| node_ir
node_pipeline -->|"optimizes"| node_optimizer
node_pipeline -->|"generates bytecode"| node_bytecode
node_pipeline -->|"selects native backend"| node_llvm
node_build -->|"uses cache"| node_cache
node_build -->|"writes artifacts"| node_artifacts
node_pipeline -->|"emits events"| node_events
node_pipeline -->|"reports errors"| node_diagnostics
node_project -.->|"schedules builds"| node_support
node_bytecode -->|"writes bytecode"| node_artifacts
node_artifacts -->|"loads artifact"| node_vm
node_vm -->|"uses services"| node_runtime_services
node_llvm -->|"uses services"| node_runtime_services
node_runtime_services -->|"exposes modules"| node_stdlib
node_vm -->|"executes program"| node_output
node_runtime_services -->|"provides effects"| node_output
node_tsc -->|"selects interpreter"| node_interpreter
node_tsc -->|"offers formatting"| node_formatter
node_tsc -->|"offers lint and migration"| node_linter
node_tsc -->|"offers language server"| node_lsp
node_tsc -->|"offers package commands"| node_packages
node_vscode -.->|"editor integration"| node_lsp

click node_tsc "https://github.com/tcode-motion/techscript/blob/main/cli/src/main.rs"
click node_project "https://github.com/tcode-motion/techscript/blob/main/cli/src/project.rs"
click node_config "https://github.com/tcode-motion/techscript/blob/main/cli/src/config.rs"
click node_build "https://github.com/tcode-motion/techscript/blob/main/cli/src/commands/build.rs"
click node_pipeline "https://github.com/tcode-motion/techscript/blob/main/cli/src/pipeline.rs"
click node_cache "https://github.com/tcode-motion/techscript/blob/main/cli/src/cache.rs"
click node_artifacts "https://github.com/tcode-motion/techscript/blob/main/cli/src/artifacts.rs"
click node_diagnostics "https://github.com/tcode-motion/techscript/blob/main/cli/src/diagnostics.rs"
click node_events "https://github.com/tcode-motion/techscript/blob/main/cli/src/events.rs"
click node_support "https://github.com/tcode-motion/techscript/blob/main/cli/src/scheduler.rs"
click node_lexer "https://github.com/tcode-motion/techscript/blob/main/compiler/lexer/src/lib.rs"
click node_parser "https://github.com/tcode-motion/techscript/blob/main/compiler/parser/src/parser.rs"
click node_semantic "https://github.com/tcode-motion/techscript/blob/main/compiler/semantic/src/pipeline.rs"
click node_resolver "https://github.com/tcode-motion/techscript/blob/main/compiler/module_resolver/src/lib.rs"
click node_optimizer "https://github.com/tcode-motion/techscript/blob/main/compiler/optimizer/src/pipeline.rs"
click node_ir "https://github.com/tcode-motion/techscript/blob/main/compiler/ir/src/lowering.rs"
click node_bytecode "https://github.com/tcode-motion/techscript/blob/main/compiler/bytecode/src/lowering.rs"
click node_llvm "https://github.com/tcode-motion/techscript/blob/main/compiler/llvm_backend/src/codegen.rs"
click node_vm "https://github.com/tcode-motion/techscript/blob/main/runtime/vm/src/executor.rs"
click node_interpreter "https://github.com/tcode-motion/techscript/blob/main/runtime/interpreter/src/interpreter.rs"
click node_runtime_services "https://github.com/tcode-motion/techscript/blob/main/runtime/runtime/src/context.rs"
click node_stdlib "https://github.com/tcode-motion/techscript/blob/main/stdlib/src/lib.rs"
click node_formatter "https://github.com/tcode-motion/techscript/blob/main/tools/formatter/src/lib.rs"
click node_linter "https://github.com/tcode-motion/techscript/blob/main/tools/linter/src/lib.rs"
click node_lsp "https://github.com/tcode-motion/techscript/blob/main/tools/lsp/src/lib.rs"
click node_packages "https://github.com/tcode-motion/techscript/blob/main/tools/package-manager/src/lib.rs"
click node_vscode "https://github.com/tcode-motion/techscript/blob/main/editors/vscode/extension.js"

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_tsc,node_project,node_config,node_build,node_pipeline,node_cache,node_artifacts,node_diagnostics,node_events,node_support toneBlue
class node_lexer,node_parser,node_semantic,node_resolver toneAmber
class node_optimizer,node_ir,node_bytecode,node_llvm toneMint
class node_vm,node_interpreter,node_runtime_services,node_stdlib toneRose
class node_formatter,node_linter,node_lsp,node_packages,node_vscode,node_developer,node_source,node_manifest,node_output toneIndigo
```

## Components

### CLI and Projects

- [tsc Driver](https://github.com/tcode-motion/techscript/blob/main/cli/src/main.rs): `cli/src/main.rs`
- [Project Management](https://github.com/tcode-motion/techscript/blob/main/cli/src/project.rs): `cli/src/project.rs`
- [Build Configuration](https://github.com/tcode-motion/techscript/blob/main/cli/src/config.rs): `cli/src/config.rs`
- [Build and Check](https://github.com/tcode-motion/techscript/blob/main/cli/src/commands/build.rs): `cli/src/commands/build.rs`
- [Compiler Pipeline](https://github.com/tcode-motion/techscript/blob/main/cli/src/pipeline.rs): `cli/src/pipeline.rs`
- [Incremental Cache](https://github.com/tcode-motion/techscript/blob/main/cli/src/cache.rs): `cli/src/cache.rs`
- [Artifact Manager](https://github.com/tcode-motion/techscript/blob/main/cli/src/artifacts.rs): `cli/src/artifacts.rs`
- [Diagnostics](https://github.com/tcode-motion/techscript/blob/main/cli/src/diagnostics.rs): `cli/src/diagnostics.rs`
- [Compilation Events](https://github.com/tcode-motion/techscript/blob/main/cli/src/events.rs): `cli/src/events.rs`
- [Build Support](https://github.com/tcode-motion/techscript/blob/main/cli/src/scheduler.rs): `cli/src/scheduler.rs`

### Language Frontend

- [Lexer](https://github.com/tcode-motion/techscript/blob/main/compiler/lexer/src/lib.rs): `compiler/lexer/src/lib.rs`
- [Parser and AST](https://github.com/tcode-motion/techscript/blob/main/compiler/parser/src/parser.rs): `compiler/parser/src/parser.rs`
- [Semantic Analysis](https://github.com/tcode-motion/techscript/blob/main/compiler/semantic/src/pipeline.rs): `compiler/semantic/src/pipeline.rs`
- [Module Resolver](https://github.com/tcode-motion/techscript/blob/main/compiler/module_resolver/src/lib.rs): `compiler/module_resolver/src/lib.rs`

### Compilation Backends

- [IR Optimization](https://github.com/tcode-motion/techscript/blob/main/compiler/optimizer/src/pipeline.rs): `compiler/optimizer/src/pipeline.rs`
- [IR Lowering](https://github.com/tcode-motion/techscript/blob/main/compiler/ir/src/lowering.rs): `compiler/ir/src/lowering.rs`
- [Bytecode Backend](https://github.com/tcode-motion/techscript/blob/main/compiler/bytecode/src/lowering.rs): `compiler/bytecode/src/lowering.rs`
- [LLVM Backend](https://github.com/tcode-motion/techscript/blob/main/compiler/llvm_backend/src/codegen.rs): `compiler/llvm_backend/src/codegen.rs`

### Runtime

- [Bytecode VM](https://github.com/tcode-motion/techscript/blob/main/runtime/vm/src/executor.rs): `runtime/vm/src/executor.rs`
- [Tree Interpreter](https://github.com/tcode-motion/techscript/blob/main/runtime/interpreter/src/interpreter.rs): `runtime/interpreter/src/interpreter.rs`
- [Runtime Services](https://github.com/tcode-motion/techscript/blob/main/runtime/runtime/src/context.rs): `runtime/runtime/src/context.rs`
- [Standard Library](https://github.com/tcode-motion/techscript/blob/main/stdlib/src/lib.rs): `stdlib/src/lib.rs`

### Developer Tools

- [Formatter](https://github.com/tcode-motion/techscript/blob/main/tools/formatter/src/lib.rs): `tools/formatter/src/lib.rs`
- [Linter and Migrator](https://github.com/tcode-motion/techscript/blob/main/tools/linter/src/lib.rs): `tools/linter/src/lib.rs`
- [Language Server](https://github.com/tcode-motion/techscript/blob/main/tools/lsp/src/lib.rs): `tools/lsp/src/lib.rs`
- [Package Manager](https://github.com/tcode-motion/techscript/blob/main/tools/package-manager/src/lib.rs): `tools/package-manager/src/lib.rs`
- [VS Code Extension](https://github.com/tcode-motion/techscript/blob/main/editors/vscode/extension.js): `editors/vscode/extension.js`

### Other components

- **Developer**
- **TechScript Source**
- **Project Manifest**
- **Program Output**

## Connections

- Developer → tsc Driver: invokes (evidence: `README.md`)
- TechScript Source → tsc Driver: provides source (evidence: `README.md`)
- Project Manifest → tsc Driver: provides project (evidence: `README.md`)
- tsc Driver → Build and Check: dispatches commands (evidence: `cli/src/main.rs`)
- Build and Check → Build Configuration: loads settings (evidence: `cli/src/commands/build.rs`)
- Build and Check → Project Management: loads project (evidence: `cli/src/commands/build.rs`)
- Build and Check → Compiler Pipeline: compiles through (evidence: `cli/src/commands/build.rs`)
- Compiler Pipeline → Lexer: tokenizes (evidence: `README.md`)
- Compiler Pipeline → Parser and AST: parses (evidence: `README.md`)
- Compiler Pipeline → Semantic Analysis: validates (evidence: `README.md`)
- Compiler Pipeline → Module Resolver: resolves modules (evidence: `README.md`)
- Compiler Pipeline → IR Lowering: lowers to IR (evidence: `README.md`)
- Compiler Pipeline → IR Optimization: optimizes (evidence: `cli/src/pipeline.rs`)
- Compiler Pipeline → Bytecode Backend: generates bytecode (evidence: `README.md`)
- Compiler Pipeline → LLVM Backend: selects native backend (evidence: `README.md`)
- Build and Check → Incremental Cache: uses cache (evidence: `cli/src/commands/build.rs`)
- Build and Check → Artifact Manager: writes artifacts (evidence: `cli/src/commands/build.rs`)
- Compiler Pipeline → Compilation Events: emits events (evidence: `cli/src/pipeline.rs`)
- Compiler Pipeline → Diagnostics: reports errors (evidence: `cli/src/pipeline.rs`)
- Project Management → Build Support: schedules builds (evidence: `cli/src/scheduler.rs`)
- Bytecode Backend → Artifact Manager: writes bytecode (evidence: `README.md`)
- Artifact Manager → Bytecode VM: loads artifact (evidence: `README.md`)
- Bytecode VM → Runtime Services: uses services (evidence: `README.md`)
- LLVM Backend → Runtime Services: uses services (evidence: `README.md`)
- Runtime Services → Standard Library: exposes modules (evidence: `stdlib/src/lib.rs`)
- Bytecode VM → Program Output: executes program (evidence: `README.md`)
- Runtime Services → Program Output: provides effects (evidence: `README.md`)
- tsc Driver → Tree Interpreter: selects interpreter
- tsc Driver → Formatter: offers formatting (evidence: `README.md`)
- tsc Driver → Linter and Migrator: offers lint and migration (evidence: `README.md`)
- tsc Driver → Language Server: offers language server (evidence: `README.md`)
- tsc Driver → Package Manager: offers package commands (evidence: `README.md`)
- VS Code Extension → Language Server: editor integration
