Skip to content

mehrankamal/clox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

79 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLox

CLox is a compiler frontend and virtual machine implementation for running the Lox language, as described in the Crafting Interpreters book. It is written in C and follows the structure laid out in the book.

Warning: This implementation of Lox is intended for educational purposes only and should not be used as a production language. It lacks many features and optimizations necessary for production environments, such as comprehensive error handling, security measures, and performance optimizations.

How to Run?

Software Requirements

The following instructions have been tested on macOS. If you encounter issues on other operating systems or machines, please let me know.

For macOS

  • A C compiler (such as clang or gcc)
  • CMake
  • Make

Compilation

Once you have the necessary dependencies installed, you can compile CLox using the following command:

make clean cmake

After a successful compilation, the CLox binary will be located in the ./build/ folder of the cloned repository.

Running the Compiler

You can run the compiler in two modes: REPL mode and File Compilation mode.

REPL Mode

To start an interactive REPL session, run:

./build/CLox

File Compilation Mode

The Lox compiler can also take a file path as input. Currently, it only supports single-file execution and does not yet support modules.

./build/CLox <path-to-file>

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages