Skip to content

Sheape/fox

Repository files navigation

Fox

Release Rust version

Overview

Fox is a fast Lox interpreter written in rust based from the specifications in the Lox programming language by Robert Nystrom. Lox is known as a dynamic scripting language but with some OOP aspects like classes and inheritance. Imports are not included in this interpreter, however it's easy to add given the structure of the code.

Features

  • High Performance Lexer and Parser (Index-based AST similar to zig)
  • Stack-based Bytecode VM
  • Evaluating expressions
  • Useful Error Messages
  • Global and Local variable declaration
  • Scoping
  • Conditional statements
  • For and While statements
  • Functions
  • Classes & OOP
  • REPL

Setup

  1. Clone this repository.
  2. Install the rust toolchain version 1.88.0.
  3. Build the projcet with cargo build or if you are in release mode, cargo build --release.
  4. Run the interpreter with either the following subcommands depending on the output that you want: tokenize (lexer), parse (parser), evaluate (evaluator), or run (run with bytecode VM). cargo run <subcommand> <file_name>.

WIP

While this is a working interpreter at the moment, I wanted to finish it as a usable complete day-to-day interpreter that you would actually use. Providing a good developer experience is key to a good interpreter. Some features that I will definitely implement are pretty error messages, interactive REPL, and maybe in the future an LSP server with treesitter.

About

Fast Interpreter for the Lox programming language

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •