C implementation of the Lox programming language
Explore the docs »
Report Bug
·
Request Feature
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.
- 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
- Note: this dependency is embedded in the
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.
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.
- Clone the repo
git clone https://github.com/davidtwilcox/clox.git
- Create your build files (run these commands in the clox root directory)
$ cmake -DCMAKE_BUILD_TYPE=Debug -G "YOUR_PREFERRED_IDE" PATH_TO_SOURCE
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.
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.
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
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.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
David Wilcox - @davidtwilcox - [email protected]
Project Link: https://github.com/davidtwilcox/clox
- Bob Nystrom - Author of Crafting Interpreters