Command Palette

Search for a command to run...

PyLox Interpreter

PyLox Interpreter

Following Robert Nystrom's book on building interpreters with a variety of customizations and capabilities, an interpreter for the Lox language was created using Python.

#python#lox#interpreter

About the Project

This project is an extended and enhanced Python implementation of the Lox interpreter, featuring a robust lexer, parser, and runtime system. It supports expressions, variables, control flow (if-else, loops), functions (first-class, closures, and recursion), and OOP (classes, inheritance, constructors, and methods). Advanced features include compile-time variable resolution, namespaces, improved error handling, exceptions, and an import system. It introduces new operators, built-in types (lists, dictionaries), indexing, higher-order functions (map, filter, reduce), and a growing standard library with modules for I/O, randomization, HTTP, and mathematics.

Project Details

Date

May 1, 2023

Links

Technologies

pythonmarkdownjekyllgithubactions

Key Features

  • Fully Functional Interpreter – Supports execution via a REPL and script mode.
  • Expressions & Statements – Arithmetic, logical, and comparison operators.
  • Control Flow – if-else, while, for, and logical and/or operators.
  • Classes & OOP – Class declarations, object properties, methods, this, and inheritance.
  • Import System – Modular scripting and library support.
  • Improved Error Handling – Better syntax/runtime error messages and multi-error reporting.
  • Enhanced Functionality – Default parameters, *args, lambda expressions.
  • New Data Types – Strings, integers, lists, dictionaries, with full indexing support.

Screenshots