Skip to content
Lox bytecode VM written in C++ - Based on Part III of Bob Nystrom's Book "Crafting Interpreters"
C++ Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cloxpp.xcodeproj
cloxpp
test
.gitignore
LICENSE.txt
README.md
test.py
test_cloxpp.py

README.md

cloxpp

This project follows Bob Nystrom's excellent book, Crafting Interpreters which takes you through the process of writing an interpreter for a language called Lox.

The book goes over two implementations:

  1. A tree-walking interpreter written in Java. I have ported that interpreter to Swift in slox.

  2. A bytecode interpreter written in C. I'm porting that to Swift (bslox) and C++ (this repo).

The book is being released as chapters are completed, one chapter at a time.

Progress

This port implements code from the following chapters of Part III of the book:

  1. Chunks of Bytecode.
  2. A Virtual Machine.
  3. Scanning on Demand.
  4. Compiling Expressions.
  5. Types of Values.
  6. Strings.
  7. Hash Tables. (no code, using std containers)
  8. Globals Variables.
  9. Local Variables.
  10. Jumping Back and Forth.

Tests

The test suite is from the reference C implementation. To run the tests:

./test_cloxpp.py chap23_jumping

The test script assumes that the binary is in build/Release/cloxpp, which is where it ends up after running xcodebuild from the command line.

Goals & Design

My goal in this project is to become more proficient in C++.

License

MIT

You can’t perform that action at this time.