Skip to content
/ cloxpp Public
forked from hashemi/cloxpp

Lox bytecode VM written in C++ - Based on Part III of Bob Nystrom's Book "Crafting Interpreters"

License

Notifications You must be signed in to change notification settings

gaetgu/cloxpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Lox bytecode VM written in C++ - Based on Part III of Bob Nystrom's Book "Crafting Interpreters"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 57.7%
  • Python 42.3%