{"id":17174811,"url":"https://github.com/benhoyt/loxlox","last_synced_at":"2025-04-13T16:21:25.953Z","repository":{"id":65731693,"uuid":"151088848","full_name":"benhoyt/loxlox","owner":"benhoyt","description":"Lox interpreter written in Lox","archived":false,"fork":false,"pushed_at":"2023-06-27T10:02:42.000Z","size":101,"stargazers_count":117,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T07:11:45.540Z","etag":null,"topics":["crafting-interpreters","interpreter","lox","meta"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benhoyt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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-10-01T12:56:59.000Z","updated_at":"2025-02-16T09:20:13.000Z","dependencies_parsed_at":"2024-11-07T22:01:34.708Z","dependency_job_id":"466cba4e-5438-483e-9ad0-8fd82265f302","html_url":"https://github.com/benhoyt/loxlox","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhoyt%2Floxlox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhoyt%2Floxlox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhoyt%2Floxlox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benhoyt%2Floxlox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benhoyt","download_url":"https://codeload.github.com/benhoyt/loxlox/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248741845,"owners_count":21154386,"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":["crafting-interpreters","interpreter","lox","meta"],"created_at":"2024-10-14T23:54:57.763Z","updated_at":"2025-04-13T16:21:25.932Z","avatar_url":"https://github.com/benhoyt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\nLoxLox\n======\n\nLoxLox is an interpreter for [Crafting Interpreters'](http://www.craftinginterpreters.com/) [Lox](http://www.craftinginterpreters.com/the-lox-language.html) language written in ... Lox.\n\nBelow are a few notes about running LoxLox, but you can [**read more about LoxLox here**](https://benhoyt.com/writings/loxlox/).\n\n\n## How to run LoxLox\n\nFirst clone the LoxLox repo as well as the Crafting Interpreters one:\n\n```\n$ git clone https://github.com/benhoyt/loxlox\n$ git clone https://github.com/munificent/craftinginterpreters\n```\n\n### JLox\n\nThen patch the Crafting Interpreters repo to add the required builtins to JLox (`getc`, `chr`, etc) and build JLox:\n\n```\n$ cd craftinginterpreters\n$ git apply ../loxlox/jlox_diff.patch\n$ make jlox\n$ cd ../loxlox\n```\n\nNow you're ready to run LoxLox (input is passed to LoxLox on stdin):\n\n```\n$ \n$ ./jlox lox.lox \u003c example.lox\n1\n4\n9\n16\nWaddles quacks\n6\n105\n$ ./jlox lox.lox \u003c sum.lox \n4.99995E9\n$ echo 'print \"Hello world!\";' | ./jlox lox.lox \nHello world!\n```\n\n### CLox\n\nThanks to [gloria-mundi](https://github.com/gloria-mundi)'s [patch](https://github.com/benhoyt/loxlox/blob/master/clox_diff.patch), you can now even run LoxLox under CLox. Patch the Crafting Interpreters repo in much the same way as above:\n\n```\n$ cd ../craftinginterpreters\n$ git apply ../loxlox/clox_diff.patch\n$ make clox\n$ cd ../loxlox\n```\n\nYou should now be able to run the examples the same way as above, but replace `./jlox` with `./clox`. It's about 6x as fast -- see the [benchmarks](https://github.com/benhoyt/loxlox/pull/3)!\n\n\n## Running the tests\n\nTo run the Lox test suite under LoxLox, use this command:\n\n```\n$ python3 test.py\n```\n\nNote that several tests will fail. That's expected -- the code works; the remaining failures are only from differences in the runtime error messages between JLox and LoxLox.\n\nTo run the tests and diff against the git-committed failures file (should be no diffs):\n\n```\n$ python3 test.py \u003e failures\n$ git diff failures\n```\n\n\n## Contact me\n\n[Contact me](https://benhoyt.com/) if you have any feedback or suggestions. And if you get LoxLox to run under LoxLox ... mind blown.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenhoyt%2Floxlox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenhoyt%2Floxlox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenhoyt%2Floxlox/lists"}