Skip to content

zxul767/lox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Implementations of the Lox interpreter and compiler described in the wonderful book: https://craftinginterpreters.com (freely available online!)

crafting-interpreters

The original code comes straight from the book, but I made quite a few refactorings as I was studying each chapter.

Book Challenges

At the end of every chapter in the book, there are a few challenges to deepen the reader's understanding of the material, or to add additional feature to the interpreter or compiler. You can find my answers in the challenges.md file.

jlox

jlox

jlox is a simple interpreter for Lox written in Java. It parses the code and turns into an AST which is then directly traversed for interpretation (i.e., no bytecode generation). It is easy to understand but it is also relatively slow.

clox

clox

clox is a compiler/interpreter for Lox written in C. It is a single-pass compiler (unlike jlox which does several passes) which generates bytecode for a Lox virtual machine directly as it is parsing (i.e., it doesn't build an AST). It is designed to be much faster than jlox but it is harder to understand due to the low-level constructs needed (e.g., bytecode generation, hash tables, garbage collection).

About

An interpreter for the Lox language

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published