GithubHelp home page GithubHelp logo

jamesbuch / loxpp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from neeilan/loxpp

0.0 0.0 0.0 107 KB

C++ port of jlox, the reference lox interpreter

C++ 92.72% Python 5.06% Makefile 1.20% CMake 1.02%

loxpp's Introduction

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.

loxpp's People

Contributors

neeilan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.