h-hg / lox

C++ implementation of Lox interpreter (based on the book Crafting Interpreters by Bob Nystrom)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

C++ implementation of Lox (WIP)

I'm reading Crafting Interpreters book by Bob Nystrom and writing Lox interpreter in C++ as I do this (the original code in the book is written in Java and some is in C). It's fun!

Some day I will return to it... Maybe in another language?

Chapters complete

  1. Scanning
  2. Represening code
  3. Parsing Expressions
  4. Evaluating Expressions
  5. Statements and State
  6. Control flow
  7. Functions (in progress)

Building

Just run CMake like this:

# in build dir
cmake <src-dir>

and then

cmake --build . --target lox

To build with tests:

# in build dir
cmake <src-dir> -DBUILD_TESTING=ON

To run tests:

cmake --build . --target check

Alternatively:

ctest .

Usage

Run a simple example:

lox examples/test.lox

TODO

License

This project is licensed under the MIT License, see LICENSE for more information.

About

C++ implementation of Lox interpreter (based on the book Crafting Interpreters by Bob Nystrom)

License:MIT License


Languages

Language:C++ 97.1%Language:CMake 2.9%