Skip to content

davidtwilcox/clox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

clox

C implementation of the Lox programming language
Explore the docs »

Report Bug · Request Feature

Table of Contents

About The Project

This is (so far) a direct C implementation of clox in Section III of Bob Nystrom's site Crafting Interpreters.

As the project grows, a standard library and new language features will be added. Expect this implementation to deviate from the original Lox specification in the future. When that happens, the project will be renamed (per Bob Nystrom's request in his book) to avoid confusion with the original Lox language specification.

Built With

  • C and the C standard library
  • Unity unit testing framework for C
    • Note: this dependency is embedded in the 3rdparty/unity folder in the repo due to a minor change in a header required for compilation on Windows 10

Getting Started

To get a local copy up and running follow these simple steps. The instructions assume you are on a Linux or Unix-like system. I can verify this will work on macOS as well.

Prerequisites

None other than a working C compiler and C standard library for your system. The Unity test framework is included in the 3rdparty/unity folder in the repo.

Installation

  1. Clone the repo
git clone https://github.com/davidtwilcox/clox.git
  1. Create your build files (run these commands in the clox root directory)
$ cmake -DCMAKE_BUILD_TYPE=Debug -G "YOUR_PREFERRED_IDE" PATH_TO_SOURCE

Repository structure

The clox compiler is in the src folder. Unit tests are in the test folder. All external dependencies that are shipped with the project are in the 3rdparty folder.

Usage

For now, reference the Lox grammar appendix on the Crafting Interpreters site. In the future, as clox adds new features and forks from the original language specification, a full grammar reference will be included here.

To run unit tests for the compiler, build the code in the test folder. This exercises the compiler itself.

Roadmap

See the open issues for a list of proposed features (and known issues).

  • [IN PROGRESS] Add a standard library to enable more functionality
  • Implement new language features

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

David Wilcox - @davidtwilcox - david@dtwil.co

Project Link: https://github.com/davidtwilcox/clox

Acknowledgements

About

A C implementation of the Lox programming language from https://craftinginterpreters.com/

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published