Beesafe is a small, educational interpreter written in Rust. It includes a lexer, parser, AST, and executor, along with a simple REPL. The goal is to explore how programming languages are built end-to-end in a clear, approachable way.
- REPL: interactive prompt powered by
rustyline. - Lexer and Parser: tokenization and parsing into an AST.
- Executor: walks the AST to evaluate programs.
- Environment: scoped variable bindings and symbol handling.
- Error reporting: friendly diagnostics via
mietteandthiserror.
Prerequisites: Rust (edition 2021). Install via rustup if needed.
- Run the REPL:
cargo runYou should see a prompt like >>. Type a line of code, press Enter to see the parsed program and evaluated result. Use Ctrl-C or Ctrl-D to exit.
- Run tests:
cargo testsrc/lexer.rs: tokenizationsrc/parser.rs: parsing to ASTsrc/ast.rs: AST node definitionssrc/executor.rs: AST evaluationsrc/environment.rs: variable scopes and symbolssrc/symbols.rs: object/value representationssrc/allocator.rs: internal memory utilitiessrc/main.rs: REPL entrypointtests/: unit tests for the core components
- The interpreter is a work-in-progress; syntax and semantics may change.
- Contributions and experiments are welcome for learning and exploration.