Skip to content

SujayKarpur/plox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

99 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

plox

python implementation of the Lox programming language

Usage

Clone the repository

$ git clone https://github.com/SujayKarpur/plox.git
$ cd plox

Set up and activate a python virtual environment

$ python3 -m venv venv
$ source venv/bin/activate

Execute the build script

$ ./build/build.sh

Run plox in the desired mode

$ plox [script] [--debug] [--optimize] [--time]

About

Lox (from the book Crafting Interpreters) is a dynamically typed, high level scripting language designed to be easy to understand and implement.

This project is a treewalk interpreter for my version of Lox, with a handcrafted lexer and recursive descent parser.

Plox in action

Interface

REPL

Script

Interpreter Flags

Implementation

Lexical Grammar

Syntactic Grammar

Interpreter Architecture

Types

Lexing

Parsing

AST

Interpreter

State and Environment

Control Flow

Functional Constructs

References

Crafting Interpreters
Compilers Principles, Techniques, and Tools
PLY documentation

Current Status

To Do

  • Improve runtime error handling (print line containing error and show column)
  • Finish README
  • Make list indices lvalues, ie support statements like variable[i] = value;
  • Improve documentation and readability
  • Add functional programming constructs like decorators, generators, and pattern matching
  • Implement a way to import and reuse code across different plox scripts & add a standard library

Takeaways

Design Patterns

Visitor Pattern

Global State

Static vs Dynamic Typing

About

python implementation of the Lox programming language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published