Skip to content

A byte code compiler and interpreter written in c to compile and run the Object Oriented language Lox.

Notifications You must be signed in to change notification settings

hunterwilkins2/clox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lox Bytecode Compiler

Lox is an Object Oriented language designed by Bob Nystrom in his book Crafting Interpreters to teach design principals behind language design and data structures used to design compilers.


This version of lox closely follows Bob's book and was aimed at creating an efficient bytecode interpreter to compile lox. The first half of the book demonstrated how a tree-walk interpreter works. His implementation was written in java, known as jlox, you can check out my implementation of the tree-walk interpreter, known as pylox, here.

Requirments

  • cmake: version <= 3.20

To run

You can run a repl with:

$ ./build/apps/main


Or you can run a lox file with:

$ ./build/apps/main nameOfFile

Run a test project

I have included two test projects to see lox running.
To see an example of inheritance in Lox run:

$ ./build/apps/main ./TestProjects/Lox_Inheritance.lox


To see an example of Lox classes run:

$ ./build/apps/main ./TestProjects/Lox_LinkedLists.lox

Author

About

A byte code compiler and interpreter written in c to compile and run the Object Oriented language Lox.

Topics

Resources

Stars

Watchers

Forks