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:
-
A tree-walking interpreter written in Java. I have ported that interpreter to Swift in slox.
-
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.
This port implements code from the following chapters of Part III of the book:
- Chunks of Bytecode.
- A Virtual Machine.
- Scanning on Demand.
- Compiling Expressions.
- Types of Values.
- Strings.
- Hash Tables. (no code, using
std
containers) - Globals Variables.
- Local Variables.
- Jumping Back and Forth.
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.
My goal in this project is to become more proficient in C++.
MIT