# bmarques1995/star architecture

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

- Interactive diagram: https://gitdiagram.com/bmarques1995/star
- Repository: https://github.com/bmarques1995/star

## Overview

Star is an embeddable C++ scripting language. Its main user workflow accepts source through the REPL or file runner, then the runtime performs lexical analysis, parsing, name resolution, and tree-walk execution; execution evaluates values, environments, functions, and objects, with native functions available for integration. The repository also includes AST printing and a separate register-based VM implementation. Runtime and language components are represented from the source index; some internal call details are not excerpted, so those links are marked unverified.

Main entry points: [`src/star/source/Interpreter.cc`](https://github.com/bmarques1995/star/blob/master/src/star/source/Interpreter.cc) (Tree-walk interpreter), [`src/star/source/Runtime.cc`](https://github.com/bmarques1995/star/blob/master/src/star/source/Runtime.cc) (Runtime pipeline), [`src/star/source/Value.cc`](https://github.com/bmarques1995/star/blob/master/src/star/source/Value.cc) (Values and operations), [`src/repl/Repl.cc`](https://github.com/bmarques1995/star/blob/master/src/repl/Repl.cc) (REPL and file runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_repl["REPL and file runner<br/>[Repl.cc]"]
  node_cli["CLI entry<br/>[main.cc]"]
  node_print["Native print<br/>[Print.cc]"]
  node_console["Console output<br/>[Console.cc]"]
end

subgraph group_language["Language front end"]
  node_scanner["Scanner<br/>[Scanner.cc]"]
  node_tokens["Tokens<br/>[Token.cc]"]
  node_parser["Parser and AST<br/>[Parser.cc]"]
  node_astprinter["AST printer<br/>[AstPrinter.cc]"]
  node_resolver["Resolver<br/>[Resolver.cc]"]
end

subgraph group_runtime["Runtime execution"]
  node_runtime["Runtime pipeline<br/>[Runtime.cc]"]
  node_interpreter["Tree-walk interpreter<br/>[Interpreter.cc]"]
  node_environment["Environments<br/>[Environment.cc]"]
  node_values["Values and operations<br/>[Value.cc]"]
  node_operations["Value operations<br/>[ValueOperations.cc]"]
  node_functions["Functions<br/>[Function.cc]"]
  node_classes["Classes and instances<br/>[Class.cc]"]
  node_instance["Instance behavior<br/>[Instance.cc]"]
  node_native["Native escape<br/>[Escape.cc]"]
  node_regex["Regex processing<br/>[RegexProcessor.cc]"]
end

subgraph group_vm["Virtual machine"]
  node_vm["VM dispatcher<br/>[VM.cc]"]
  node_push["Push instructions<br/>[Push.cc]"]
  node_exit["Exit instruction<br/>[Exit.cc]"]
  node_registers["Register buffer<br/>[RegisterBuffer.cc]"]
end

node_user(("Script author"))

node_user -->|"provides source"| node_repl
node_cli -->|"starts"| node_repl
node_repl -->|"runs source"| node_runtime
node_runtime -.->|"scans"| node_scanner
node_runtime -.->|"parses"| node_parser
node_runtime -.->|"resolves"| node_resolver
node_runtime -.->|"executes"| node_interpreter
node_scanner -->|"creates tokens"| node_tokens
node_parser -.->|"consumes tokens"| node_tokens
node_parser -.->|"produces AST"| node_astprinter
node_resolver -.->|"resolves names for"| node_interpreter
node_interpreter -.->|"uses scopes"| node_environment
node_interpreter -->|"evaluates values"| node_values
node_interpreter -->|"calls"| node_functions
node_interpreter -->|"accesses properties"| node_instance
node_classes -->|"constructs instances"| node_instance
node_values -->|"represents classes"| node_classes
node_values -->|"represents instances"| node_instance
node_values -->|"represents callables"| node_functions
node_values -.->|"delegates operations"| node_operations
node_interpreter -->|"registers escape"| node_native
node_repl -->|"registers native"| node_print
node_print -->|"writes output"| node_console
node_vm -->|"dispatches"| node_push
node_vm -->|"dispatches"| node_exit
node_vm -.->|"uses registers"| node_registers

click node_repl "https://github.com/bmarques1995/star/blob/master/src/repl/Repl.cc"
click node_cli "https://github.com/bmarques1995/star/blob/master/src/repl/main.cc"
click node_scanner "https://github.com/bmarques1995/star/blob/master/src/star/source/Scanner.cc"
click node_tokens "https://github.com/bmarques1995/star/blob/master/src/star/source/Token.cc"
click node_parser "https://github.com/bmarques1995/star/blob/master/src/star/source/Parser.cc"
click node_astprinter "https://github.com/bmarques1995/star/blob/master/src/star/source/AstPrinter.cc"
click node_resolver "https://github.com/bmarques1995/star/blob/master/src/star/source/Resolver.cc"
click node_runtime "https://github.com/bmarques1995/star/blob/master/src/star/source/Runtime.cc"
click node_interpreter "https://github.com/bmarques1995/star/blob/master/src/star/source/Interpreter.cc"
click node_environment "https://github.com/bmarques1995/star/blob/master/src/star/source/Environment.cc"
click node_values "https://github.com/bmarques1995/star/blob/master/src/star/source/Value.cc"
click node_operations "https://github.com/bmarques1995/star/blob/master/src/star/source/ValueOperations.cc"
click node_functions "https://github.com/bmarques1995/star/blob/master/src/star/source/Function.cc"
click node_classes "https://github.com/bmarques1995/star/blob/master/src/star/source/Class.cc"
click node_instance "https://github.com/bmarques1995/star/blob/master/src/star/source/Instance.cc"
click node_native "https://github.com/bmarques1995/star/blob/master/src/star/source/builtin/Escape.cc"
click node_regex "https://github.com/bmarques1995/star/blob/master/src/star/source/RegexProcessor.cc"
click node_vm "https://github.com/bmarques1995/star/blob/master/src/star_vm/source/VM.cc"
click node_push "https://github.com/bmarques1995/star/blob/master/src/star_vm/source/Push.cc"
click node_exit "https://github.com/bmarques1995/star/blob/master/src/star_vm/source/Exit.cc"
click node_registers "https://github.com/bmarques1995/star/blob/master/src/star_vm/source/RegisterBuffer.cc"
click node_print "https://github.com/bmarques1995/star/blob/master/src/star_cli/source/Print.cc"
click node_console "https://github.com/bmarques1995/star/blob/master/src/star_cli/source/Console.cc"

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_repl,node_cli,node_print,node_console toneBlue
class node_scanner,node_tokens,node_parser,node_astprinter,node_resolver toneAmber
class node_runtime,node_interpreter,node_environment,node_values,node_operations,node_functions,node_classes,node_instance,node_native,node_regex toneMint
class node_vm,node_push,node_exit,node_registers toneRose
class node_user toneIndigo
```

## Components

### Entry points

- [REPL and file runner](https://github.com/bmarques1995/star/blob/master/src/repl/Repl.cc): `src/repl/Repl.cc`
- [CLI entry](https://github.com/bmarques1995/star/blob/master/src/repl/main.cc): `src/repl/main.cc`
- [Native print](https://github.com/bmarques1995/star/blob/master/src/star_cli/source/Print.cc): `src/star_cli/source/Print.cc`
- [Console output](https://github.com/bmarques1995/star/blob/master/src/star_cli/source/Console.cc): `src/star_cli/source/Console.cc`

### Language front end

- [Scanner](https://github.com/bmarques1995/star/blob/master/src/star/source/Scanner.cc): `src/star/source/Scanner.cc`
- [Tokens](https://github.com/bmarques1995/star/blob/master/src/star/source/Token.cc): `src/star/source/Token.cc`
- [Parser and AST](https://github.com/bmarques1995/star/blob/master/src/star/source/Parser.cc): `src/star/source/Parser.cc`
- [AST printer](https://github.com/bmarques1995/star/blob/master/src/star/source/AstPrinter.cc): `src/star/source/AstPrinter.cc`
- [Resolver](https://github.com/bmarques1995/star/blob/master/src/star/source/Resolver.cc): `src/star/source/Resolver.cc`

### Runtime execution

- [Runtime pipeline](https://github.com/bmarques1995/star/blob/master/src/star/source/Runtime.cc): `src/star/source/Runtime.cc`
- [Tree-walk interpreter](https://github.com/bmarques1995/star/blob/master/src/star/source/Interpreter.cc): `src/star/source/Interpreter.cc`
- [Environments](https://github.com/bmarques1995/star/blob/master/src/star/source/Environment.cc): `src/star/source/Environment.cc`
- [Values and operations](https://github.com/bmarques1995/star/blob/master/src/star/source/Value.cc): `src/star/source/Value.cc`
- [Value operations](https://github.com/bmarques1995/star/blob/master/src/star/source/ValueOperations.cc): `src/star/source/ValueOperations.cc`
- [Functions](https://github.com/bmarques1995/star/blob/master/src/star/source/Function.cc): `src/star/source/Function.cc`
- [Classes and instances](https://github.com/bmarques1995/star/blob/master/src/star/source/Class.cc): `src/star/source/Class.cc`
- [Instance behavior](https://github.com/bmarques1995/star/blob/master/src/star/source/Instance.cc): `src/star/source/Instance.cc`
- [Native escape](https://github.com/bmarques1995/star/blob/master/src/star/source/builtin/Escape.cc): `src/star/source/builtin/Escape.cc`
- [Regex processing](https://github.com/bmarques1995/star/blob/master/src/star/source/RegexProcessor.cc): `src/star/source/RegexProcessor.cc`

### Virtual machine

- [VM dispatcher](https://github.com/bmarques1995/star/blob/master/src/star_vm/source/VM.cc): `src/star_vm/source/VM.cc`
- [Push instructions](https://github.com/bmarques1995/star/blob/master/src/star_vm/source/Push.cc): `src/star_vm/source/Push.cc`
- [Exit instruction](https://github.com/bmarques1995/star/blob/master/src/star_vm/source/Exit.cc): `src/star_vm/source/Exit.cc`
- [Register buffer](https://github.com/bmarques1995/star/blob/master/src/star_vm/source/RegisterBuffer.cc): `src/star_vm/source/RegisterBuffer.cc`

### Other components

- **Script author**

## Connections

- Script author → REPL and file runner: provides source
- CLI entry → REPL and file runner: starts (evidence: `src/repl/main.cc`)
- REPL and file runner → Runtime pipeline: runs source (evidence: `src/repl/Repl.cc`)
- Runtime pipeline → Scanner: scans
- Runtime pipeline → Parser and AST: parses
- Runtime pipeline → Resolver: resolves
- Runtime pipeline → Tree-walk interpreter: executes
- Scanner → Tokens: creates tokens (evidence: `src/star/source/Scanner.cc`)
- Parser and AST → Tokens: consumes tokens
- Parser and AST → AST printer: produces AST
- Resolver → Tree-walk interpreter: resolves names for
- Tree-walk interpreter → Environments: uses scopes
- Tree-walk interpreter → Values and operations: evaluates values (evidence: `src/star/source/Interpreter.cc`)
- Tree-walk interpreter → Functions: calls (evidence: `src/star/source/Interpreter.cc`)
- Tree-walk interpreter → Instance behavior: accesses properties (evidence: `src/star/source/Interpreter.cc`)
- Classes and instances → Instance behavior: constructs instances (evidence: `src/star/source/Class.cc`)
- Values and operations → Classes and instances: represents classes (evidence: `src/star/source/Value.cc`)
- Values and operations → Instance behavior: represents instances (evidence: `src/star/source/Value.cc`)
- Values and operations → Functions: represents callables (evidence: `src/star/source/Value.cc`)
- Values and operations → Value operations: delegates operations
- Tree-walk interpreter → Native escape: registers escape (evidence: `src/star/source/Interpreter.cc`)
- REPL and file runner → Native print: registers native (evidence: `src/repl/Repl.cc`)
- Native print → Console output: writes output (evidence: `src/star_cli/source/Print.cc`)
- VM dispatcher → Push instructions: dispatches (evidence: `src/star_vm/source/VM.cc`)
- VM dispatcher → Exit instruction: dispatches (evidence: `src/star_vm/source/VM.cc`)
- VM dispatcher → Register buffer: uses registers
