dnmfarrell / Perl-Lox

Perl Interpreter for the Lox programming language
MIT License
3 stars 0 forks source link
crafting-interpreters lox perl perl-lox programming-languages

NAME

Lox - A Perl implementation of the Lox programming language

DESCRIPTION

A Perl translation of the Java Lox interpreter from Crafting Interpreters.

INSTALL

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

SYNOPSIS

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.

TESTING

The test suite includes 238 test files from the Crafting Interpreters repo.

$ prove -l t/*

EXTENSIONS

Perl-Lox has these capabilities from the "challenges" sections of the book:

DIFFERENCES

Differences from the canonical "jlox" implementation:

AUTHOR

Copyright 2020 David Farrell

LICENSE

See LICENSE file.