How svfoxat/turbo-lang works
Main Components
a) Input Processing Layer:
• REPL (Interactive Shell)
• Source Code Input
b) Core Pipeline Components:
• Lexer (Token Generation)
• Parser (AST Construction)
• Interpreter (Evaluation)
c) Supporting Components:
• AST (Abstract Syntax Tree)
• Object System
• Environment
Component Relationships
[Source Code Input] ──────┐
[REPL Input] ────────────┤
• ↓
[Lexer] → [Token Stream] → [Parser] → [AST] → [Interpreter] → [Evaluated Result]
• ↑ ↑
• [AST Nodes] [Object System]
• ↑
• [Environment]
Detailed Component Descriptions
• REPL: Interactive command-line interface (repl/repl.go)
• Lexer: Converts source code into tokens (lexer/lexer.go)
• Parser: Builds AST from tokens (parser/parser.go)
• Interpreter: Evaluates AST and executes code (interpreter/eval.go)
• Object System: Manages runtime objects and types (object/object.go)
• Environment: Handles variable scoping and bindings (object/environment.go)
Implementation Details
Notes about specific implementation files:
• Built-in Functions: interpreter/builtins.go
• Control Flow: interpreter/control_flow.go
• Type-specific Handling: interpreter/boolean.go, numbers.go, string.go
Testing Coverage
A separate section showing test coverage:
• Lexer Tests (lexer_test.go)
• Parser Tests (parser_test.go)
• AST Tests (ast_test.go)
• Interpreter Tests (eval_test.go)