Skip to content

baioc/clox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clox

This is my implementation of Robert Nystrom's Crafting Interpreters single-pass compiler and bytecode virtual machine for the Lox language, with a slightly more disciplined C style.

Notes

It is written in standard C99 and uses core features such as Flexible Array Members (FAMs), designated struct initializers and Variable-Length Arrays (VLAs). Please note that the code here - just like in most Lox implementations - lacks internal algorithmic documentation and relies on the book for that purpose.

By "slightly more disciplined C" I simply mean there are no global variables and function-like preprocessor macros are limited to the file where they were defined (macros in headers were substituted by inline functions).

Licensing

Since this is what Bob chose with respect to the book's code, the Lox implementation uses the MIT License.

Meanwhile, the generic data structures used throughout the codebase were implemented in a separate "Simple Generic Library" (SGL), which is released under the Artistic License 2.0. It can be found in the sgl folder, which works as a completely standalone CMake project (with ctests!).