Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 1.43 KB

README.md

File metadata and controls

47 lines (27 loc) · 1.43 KB

Lox language in Python

A Python (3.6+) implementation of the Lox language, from the in-progress book Crafting Interpreters by Bob Nystrom.

This project is a port of jlox, the Java-based implementation presented throughout part of the book.

What is Lox?

Lox is a full-featured, object-oriented scripting language with dynamic typing, garbage collection, lexical scope, first-class functions, closures, classes and inheritance, and more.

Under development

This implementation is still ongoing, and there is a desire to extend the project later for educational purposes.

At the moment, the implementation follows almost every step and decision in the book, however:

  • Not all challenges have been implemented yet.
  • I'll be using null instead of nil.
  • I will try to handle both int and float numbers.
  • The TokenType enum has many more tokens and keywords than those described by the book. I recorded all the ideas that came to mind while reading the language planning section.

Requirements

The only requirement to run this project is Python 3.6+, due to the type hints used almost everywhere.

This project was developed on OS X, but it should work on any OS without any problems.

Usage

REPL

python -m lox

Enter exit or press Ctrl+D to leave.

Running a file:

python -m lox path/to/file

License

MIT License