Lox - A Perl implementation of the Lox programming language
A Perl translation of the Java Lox interpreter from Crafting Interpreters.
As long as you have Perl 5.24.0 or greater, you should be able to run plox
from the root project directory.
If you'd rather build and install it:
$ perl Makefile.PL
$ make
$ make test
$ make install
If you have built and installed plox
:
$ plox
Welcome to Perl-Lox version 0.02
>
$ plox hello.lox
Hello, World!
Otherwise from the root project directory:
$ perl -Ilib bin/plox
Welcome to Perl-Lox version 0.02
>
$ perl -Ilib bin/plox hello.lox
Hello, World!
Pass the --debug
or -d
option to plox
to print the tokens it scanned
and the parse tree.
The test suite includes 238 test files from the Crafting Interpreters repo.
$ prove -l t/*
Perl-Lox has these capabilities from the "challenges" sections of the book:
fun () { ... }
/* ... */
Differences from the canonical "jlox" implementation:
methods are equivalent
Prints "true" in plox and "false" in jlox:
class Foo { bar () { } } print Foo().bar == Foo().bar;
Copyright 2020 David Farrell
See LICENSE
file.