Giter VIP home page Giter VIP logo

loxlox's Introduction

LoxLox

LoxLox is an interpreter for Crafting Interpreters' Lox language written in ... Lox.

Below are a few notes about running LoxLox, but you can read more about LoxLox here.

How to run LoxLox

First clone the LoxLox repo as well as the Crafting Interpreters one:

$ git clone https://github.com/benhoyt/loxlox
$ git clone https://github.com/munificent/craftinginterpreters

Then patch the Crafting Interpreters repo to add the required builtins to JLox (getc, chr, etc) and build JLox:

$ cd craftinginterpreters
$ git apply ../loxlox/jlox_diff.patch
$ make jlox
$ cd ../loxlox

Now you're ready to run LoxLox (input is passed to LoxLox on stdin):

$ 
$ ./jlox lox.lox < example.lox
1
4
9
16
Waddles quacks
6
105
$ ./jlox lox.lox < sum.lox 
4.99995E9
$ echo 'print "Hello world!";' | ./jlox lox.lox 
Hello world!

Running the tests

To run the Lox test suite under LoxLox, use this command:

$ python test.py

Note that several tests will fail. That's expected -- the code works; the remaining failures are only from differences in the runtime error messages between JLox and LoxLox.

To run the tests and diff against the git-committed failures file (should be no diffs):

$ python test.py > failures
$ git diff failures

Contact me

Contact me if you have any feedback or suggestions. And if you get LoxLox to run under LoxLox ... mind blown.

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.