{"id":16499180,"url":"https://github.com/hardbyte/pylox","last_synced_at":"2025-03-01T18:15:05.169Z","repository":{"id":79897787,"uuid":"156344372","full_name":"hardbyte/pylox","owner":"hardbyte","description":"A python (and jitted rpython) implementation of the lox bytecode vm from https://www.craftinginterpreters.com","archived":false,"fork":false,"pushed_at":"2020-03-12T19:29:12.000Z","size":889,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T15:55:29.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hardbyte.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-06T07:36:35.000Z","updated_at":"2024-01-24T21:17:52.000Z","dependencies_parsed_at":"2023-05-31T09:30:52.806Z","dependency_job_id":null,"html_url":"https://github.com/hardbyte/pylox","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardbyte%2Fpylox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardbyte%2Fpylox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardbyte%2Fpylox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hardbyte%2Fpylox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hardbyte","download_url":"https://codeload.github.com/hardbyte/pylox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241404416,"owners_count":19957655,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T14:51:25.884Z","updated_at":"2025-03-01T18:15:05.129Z","avatar_url":"https://github.com/hardbyte.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"This is my attempt to create a compliant lox implementation using the \n[rpython translation toolchain](https://rpython.readthedocs.io) to get\na native \u0026 hopefully JIT compiled lox interpreter.\n\nThis isn't anywhere done but is rather my journey following the low level C \nguide from Bob Nystrom ([@munificentbob](https://twitter.com/munificentbob)) on \n[craftinginterpreters.com](https://www.craftinginterpreters.com/chunks-of-bytecode.html)\n\n\n## Running under python\n\nThis lox should be runnable using `python2` or `pypy` (with `rpython` as the only dependency):\n\n    python2 -m lox [program.lox]\n\n### Example\n\n    pypy -m lox examples/simple_add.lox\n    debug: runFile called with: examples/simple_add.lox\n    232.0\n    debug: INTERPRET_OK\n\nNote you will be dropped into a _repl_ session if you don't provide a lox script to\nexecute.\n\n\n## Translation using the rpython toolchain\n\nThe real fun is asking `rpython` to compile to an executable:\n\n    rpython --opt=2 lox/target.py\n\nNow run `targetpylox-c`:\n\n    ./targetpylox-c [program.lox]\n\nExample:\n\n    $ ./lox-c examples/lots_of_basic_calculations.lox \n    3.191743\n\n\n### A tracing JIT\n\nI've added the most basic annotation required for rpython to add its tracing JIT. \nHowever this is pretty untested and takes a couple of minutes to compile.\n\n    rpython --opt=jit lox/targetpylox.py\n\n\n## Current State\n\nCurrently an over-engineered basic calculator.\n\n    ./lox-c\n    Welcome to pylox\n    https://github.com/hardbyte/pylox\n    \u003e 3 + 4 * ((1/(2 * 3 * 4)) + (1/(4 * 5 * 6)) - (1/(6 * 7 * 8)))\n    3.188095\n    \u003e (1/256 + 2/512) \u003e 2/128\n    false\n    \u003e \"hello\" + \" world\"\n    hello world\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardbyte%2Fpylox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhardbyte%2Fpylox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhardbyte%2Fpylox/lists"}