A Python interpreter for the Lox programming language.
Project description
pylox
Introduction
This is my Python implementation of an interpreter for the Lox programming language from Robert Nystrom's Crafting Interpreters.
Python?
While the text is implemented in Java and C as its high & low-level implementations, I have no idea how to write either of them! Instead, I'll be using Python for the high-level implementation & eventually Rust for the low-level imeplementation.
Differences From Text
For the sake of fitting within a decently sized text, the fully implemented Lox spec omits features that users of other programming languages may miss. Often these are discussed as notes within a chapter, or presented as challenges at the end of a chapter. Significant difference in this implementation from the text reference are noted below.
Defined by Challenges
- (Chapter 9):
break
statements are available forfor
andwhile
loops
User Choice
- Division by zero returns
NaN
(Python'sfloat('nan')
) - Strings may be defined using either
"
or'
- Modulo operator (
%
) - Power operator (
^
) - Integer division operator (
\
) - Both floats and integers are represented
- Returns from operations between mismatched types follow Python's semantics
Additional Built-ins:
abs
ceil
floor
max
min
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file sco1-pylox-0.1.0.tar.gz
.
File metadata
- Download URL: sco1-pylox-0.1.0.tar.gz
- Upload date:
- Size: 23.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.10.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71d965c154024f370c4a60bf77291b9b2194f968147e21bbafa82a808856e150 |
|
MD5 | b07ea265a21829b180fbbb6b4a1e0039 |
|
BLAKE2b-256 | 147a13b803ecf35b8963c25a28abf2b762261362fc744485791cdaae2159d422 |
Provenance
File details
Details for the file sco1_pylox-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: sco1_pylox-0.1.0-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.11 CPython/3.10.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9206993ddb285fd9f6c427c254ca37ed2779177225fd7ebd732ff387f6a1a550 |
|
MD5 | 8d63ddc4ff55e77be081eec437f7271d |
|
BLAKE2b-256 | 5f1fe9c48f73733f2381bcb31b96daff0d7c5083fdd38eac810058a4c0290d19 |