This repository contains an implementation of the clox
interpreter, based on the book "Crafting Interpreters" by Robert Nystrom. clox
is a bytecode virtual machine for the Lox programming language, a small, high-level scripting language designed for learning purposes.
This is a personal project driven by my interest in programming languages and compilers. I am using this project as a stepping stone towards understanding compilers and interpreters. It's also my way of furthering my knowledge of C, which means that the code includes (potentially excessive) comments and explanations.
- High-level scripting language
- Dynamic typing
- Lexical scoping
- First-class functions and closures
- Object-oriented programming with classes and inheritance
- Garbage collection
- Bytecode compilation and execution
To build and run the clox
interpreter, follow these steps:
- Clone this repository:
git clone https://github.com/your_username/clox.git
cd clox
- Compile the project:
make
- Run in interactive mode:
./bin/clox
To generate a compile_commands.json
file for use with clangd, make sure that you install bear and then run the following command:
bear -- make
- "Crafting Interpreters" book by Robert Nystrom
- Lox language documentation