How trafexofive/satori works
Project Type and Purpose
• Satori is a language implementation: a statically‐typed scripting language interpreter with a bytecode VM.
• Purpose: compile .sat source files into bytecode and execute them with zero-magic, high-clarity runtime behavior.
File Structure
• Top‐level:
• Makefile & scripts/ – build/test/install automation
• infra/docker-compose.dev.yml & infra/env – dev environment setup
• docs/, ARCHITECTURE.md – design and spec documentation
• examples/ – sample programs
• benchmarks/ – performance comparisons across shells and Go
• tests/ – unit/integration tests for lexer, parser, VM, stdlib
• src/ – core implementation
• stdlib/ – standalone or extended built-in modules
• src/ layered according to ARCHITECTURE.md:
• core/ (layer 0) – value system, memory, table, object
• frontend/ (layer 1) – lexer, parser, AST, typechecker
• backend/ (layer 2) – code generator (AST → bytecode)
• runtime/ (layer 3) – VM, module loader, GC hooks
• stdlib/ (layer 4) – native bindings (io, string, etc.)
README for Additional Insights
• Confirms the 5‐layer architecture
• Highlights module system, type inference, control flow, operators
• Lists in‐progress and planned features
• CLI Driver (src/main.c, argument parsing)
• Frontend Layer – Lexer, Parser, AST builder, Typechecker (src/frontend)
• Core IR Layer – in‐memory AST & value tables (src/core)
• Backend Layer – Bytecode Code Generator (src/backend)
• Runtime Layer – Bytecode VM, module loader, memory manager (src/runtime)
• Standard Library Modules – Native C I/O, string, math, net, etc. (src/stdlib + stdlib/)
• Host OS & External Services – File system, network, time (via stdlib modules)
1. User invokes bin/satori → CLI Driver
2. CLI reads .sat file → Frontend Module
3. Lexer → Parser → Typechecker → produces AST
4. Backend codegen compiles AST → Bytecode format
5. VM loads Bytecode → executes opcodes
6. During execution, VM calls into stdlib modules → OS services
7. Output back to console or network
c. Architectural Patterns & Principles
• Layered Pipeline: strict separation of concerns (frontend → backend → runtime)
• Modular Stdlib: each module as plugin, lazy‐loaded via module system
• Zero Magic: explicit call graphs, no hidden runtime transforms
• Test harness and benchmark harness as consumers of every layer
d. Key Technologies & Frameworks
• Language: C (gcc/clang, POSIX)
• Build: Makefile, shell scripts
• Containerized Dev: Docker Compose + .env
• Testing: custom C test runners, .sat test suites
• Benchmarks: Bash vs Go comparisons