GithubHelp home page GithubHelp logo

yumasi / pylox Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 167 KB

Python implementation of the Lox programming language from the Crafting Interpreters book.

Python 98.52% Shell 0.06% Emacs Lisp 0.55% Scheme 0.87%
language lox lox-interpreter lox-language programming-language

pylox's Introduction

Pylox

Running Pylox

Prerequisites

  • Poetry
  • Python >= 3.10

Running with Poetry

poetry run pylox        # To run in REPL mode
poetry run pylox <script> # To execute a script

Challenges left

  • [ ] Interpret and print expression in the REPL (Chapter 8)

Development

Run poetry shell

poetry shell

Install pre-commit hooks

pre-commit install

Guix

Poetry

Poetry does not create a virtualenv, so we need to create one ourselves and ask Poetry to install the dependencies in it:

python3 -m venv .venv
. .venv/bin/activate
poetry install

Ruff

Ruff is not (yet) packaged in GNU Guix, so we need to build it ourselves. That’s what the dependencies in manifest.scm are for. To build Ruff run the following:

# Activate the Guix shell and source the venv
guix shell
. .venv/bin/activate
# If Ruff has been installed by Poetry
pip uninstall ruff
# Install Ruff
CC=gcc pip install --no-binary :all: ruff

Once installed in the virtualenv, you don’t need to use guix shell to do your development.

Pre-commit

Pre-commit tries to install Ruff from pip. Since this does not work in Guix, load you virtualenv, run pre-commit, find the path to its ruff installation and replace it with a symlink to your newly built Ruff

pylox's People

Contributors

yumasi avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.