Skip to content

neeilan/loxpp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loxpp

C++ port of jlox, a reference tree-walk interpreter for Bob Nystrom's Lox programming language.

Features

loxpp is designed to be interface-compliant with jlox. In addition to standard Lox syntax and semantics, loxpp supports additional features such as:

Lambda expressions commit

loxpp adds support for anonymous/lambda functions, using the following syntax:

lambda (args...) { body }

See examples of lambda usage here.

Multi-line comments commit

C++ (Clang) style non-nested multi-line comments are supported:

/* Multi
 * line
 * comment 1 */

var x = "Multiline comments!";

/* Il$$3g^l
   charac%ers '\ */

print x;

Build

Requirements:

  • A C++11 compiler (can be set via the CC option in Makefile)
  • Python, if you wish to run functional tests

Using the provided Makefile:

make          # builds the loxpp executable at ./bin
make test     # runs functional tests

Using CMake:

CMakeLists.txt is also provided, but for building the executable only.

Usage

./bin/loxpp          # enter REPL
./bin/loxpp <file>   # run file

The biggest divergence from jlox is when it comes to memory management - jlox relies on the JVM for loose object cleanup, but I haven't gotten around to implementing a garbage collector for loxpp. Other than that, error messages are slightly different, and the native clock function is not yet implemented.

About

C++ port of jlox, the reference lox interpreter

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published