Skip to content
/ clox Public

An interpreter of the Lox scripting language, implemented in C

License

Notifications You must be signed in to change notification settings

zlliang/clox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLox

An interpreter of the Lox scripting language, implemented in C.

Lox is a tiny scripting language described in Bob Nystrom's book Crafting Interpreters. I've already written an tree-walk interpreter using TypeScript, called TSLox. This C version is a bytecode virtual machine, developed along with reading Part III of the book.

Usage

First build this project. Here we use CMake:

$ mkdir build && cd build  # Create a CMake workspace
$ cmake .. && make
$ ./clox  # Start CLox

Invoking clox without parameter starts the REPL. To run Lox source files, please specify the file path. Feel free to run examples in the examples directory:

$ ./clox ../examples/hello-world.lox
Hello, world!

What's Next

By the end of 2021, I complete reading Crafting Interpreters and implement two interpreters of the Lox scripting language, in TypeScript and C respectively. I get some knowledge about creating programming languages, and it feels great! Next I may play with some toy languages, learn more optimization tricks and investigate different language features. Hope I can make some "real" production one day. ;)

Resources

About

An interpreter of the Lox scripting language, implemented in C

Topics

Resources

License

Stars

Watchers

Forks