How guyang17/hanling works
Hanling is a teaching-oriented, dynamically typed language implemented as a Go tree-walking interpreter. Users run a script, evaluate source text, or execute a file’s built-in tests through the CLI; the runtime tokenizes, parses, and interprets source, with built-ins providing language operations and I/O. The README also highlights lists, maps, error handling, and test/assert support. The sampled sources show the main execution path and CLI test dispatch; other built-in details are represented at subsystem level.
Main entry points: hanling/main.go Source runner · main.go CLI commands · builtins.go Console and files · interpreter.go Interpreter
Components 12
User entry points
- CLI commands
main.go - Source runner
pkg/hanling/main.go - File runner
pkg/hanling/main.go
Language runtime
- Lexer
pkg/hanling/lexer.go - Parser and AST
pkg/hanling/parser.go - Interpreter
pkg/hanling/interpreter.go
Runtime capabilities
- Built-in functions
pkg/hanling/builtins.go - Test runner
pkg/hanling/interpreter.go - Console and files
pkg/hanling/builtins.go
Other components
- User
- Host filesystem
- Console input/output
Connections 13
- User → CLI commands: invokes
main.go - CLI commands → File runner: runs files
main.go - CLI commands → Source runner: evaluates source
main.go - CLI commands → Test runner: runs tests
main.go - File runner → Source runner: passes source
pkg/hanling/main.go - Source runner → Lexer: tokenizes source
pkg/hanling/main.go - Source runner → Parser and AST: parses tokens
pkg/hanling/main.go - Source runner → Interpreter: executes program
pkg/hanling/main.go - Interpreter → Built-in functions: registers functions
pkg/hanling/interpreter.go - Test runner → Interpreter: evaluates tests
pkg/hanling/interpreter.go - Built-in functions → Console and files: provides I/O
pkg/hanling/builtins.go - Console and files → Host filesystem: reads and writes
pkg/hanling/builtins.go - Console and files → Console input/output: reads and prints
pkg/hanling/builtins.go