How zakiraghakishiyev/pldpi-mini-project works
IMPlex is a small Go interpreter for an imperative language. A user supplies a source file and optional integer inputs to the CLI; the CLI tokenizes and parses the program, then executes its AST and prints accumulated results. The runtime supports scoped variables and ordered input/output, while expression evaluation checks arithmetic overflow and runtime errors. The README documents control flow, lexical scoping, Boolean and comparison operators, and checked arithmetic. Relationships below follow the CLI and sampled implementation; unsampled modules are not inferred.
Main entry points: runtime.go Run State · main.go IMPlex CLI · statements.go Statement Evaluator · expressions.go Expression Evaluator
Components 10
Program Syntax
- AST Types
internal/ast/ast.go
Execution
- Statement Evaluator
internal/interpreter/statements.go - Expression Evaluator
internal/interpreter/expressions.go
Runtime State
- Run State
internal/runtime/runtime.go - Scoped Variables
internal/runtime/environment.go - Runtime Errors
internal/runtime/errors.go
Other components
- User
- IMPlex CLI
cmd/implex/main.go
Connections 20
- User → IMPlex CLI: runs with inputs
README.md - IMPlex CLI → Lexer: tokenizes source
cmd/implex/main.go - IMPlex CLI → Parser: parses tokens
cmd/implex/main.go - IMPlex CLI → Run State: creates run state
cmd/implex/main.go - IMPlex CLI → Statement Evaluator: executes program
cmd/implex/main.go - IMPlex CLI → Run State: prints results
cmd/implex/main.go - Lexer → AST Types: uses positions
internal/lexer/lexer.go - Parser → AST Types: builds syntax tree
internal/parser/parser.go - Parser → Lexer: consumes tokens
internal/parser/parser.go - Statement Evaluator → AST Types: dispatches statements
internal/interpreter/statements.go - Statement Evaluator → Expression Evaluator: evaluates expressions
internal/interpreter/statements.go - Statement Evaluator → Run State: reads and writes state
internal/interpreter/statements.go - Expression Evaluator → AST Types: evaluates expression nodes
internal/interpreter/expressions.go - Expression Evaluator → Run State: looks up variables
internal/interpreter/expressions.go - Statement Evaluator → Scoped Variables: manages block scopes
internal/interpreter/statements.go - Scoped Variables → Run State: updates bindings
internal/runtime/environment.go - Run State → Scoped Variables: stores scope stack
internal/runtime/runtime.go - Expression Evaluator → Runtime Errors: reports arithmetic errors
internal/interpreter/expressions.go - Scoped Variables → Runtime Errors: reports binding errors
internal/runtime/environment.go - Run State → Runtime Errors: reports input errors
internal/runtime/runtime.go