Skip to content

brunobmello25/interpreter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monkey Programming Language Interpreter

A Rust implementation of the Monkey programming language interpreter. This project is an implementation of the Monkey programming language as described in the book "Writing An Interpreter In Go" by Thorsten Ball, but written in Rust.

Project Structure

The project is organized into a few key components:

  • lexer/: Tokenizes the input source code
  • parser/: Parses tokens into an Abstract Syntax Tree (AST)
  • evaluator/: Evaluates the AST to produce results
  • repl/: Provides an interactive Read-Eval-Print Loop

Features

  • Interactive REPL (Read-Eval-Print Loop)
  • Lexical analysis
  • Parsing
  • Evaluation
  • Support for Monkey programming language features

Prerequisites

  • Rust (2021 edition or later)
  • Cargo (comes with Rust)

Building

To build the project:

cargo build

Testing

This project includes comprehensive unit tests for all major components. To run the tests:

cargo test

Each component (lexer, parser, evaluator) has its own test suite to ensure correct functionality.

Running

To run the REPL:

cargo run

Usage

Once the REPL is running, you can enter Monkey code expressions. To exit the REPL, enter an empty string.

Example Monkey code you can try:

let x = 5;
let y = 10;
x + y

Dependencies

  • indoc: For indented documentation strings

License

This project is open source and available under the MIT License.

About

An interpreter written in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages