{"id":21353457,"url":"https://github.com/vahor/interpreter-in-rust","last_synced_at":"2025-03-16T05:13:22.794Z","repository":{"id":232753528,"uuid":"615505941","full_name":"Vahor/interpreter-in-rust","owner":"Vahor","description":"Based on \"Writing an interpreter in Go\" https://interpreterbook.com/","archived":false,"fork":false,"pushed_at":"2023-10-18T18:51:49.000Z","size":177,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T17:29:00.330Z","etag":null,"topics":["ast","interpreter","lexer","parser","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"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/Vahor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2023-03-17T21:22:32.000Z","updated_at":"2025-01-12T09:26:43.000Z","dependencies_parsed_at":"2024-04-11T09:27:31.964Z","dependency_job_id":"f5cebdf5-87ad-4551-8d34-0bd8db2867e3","html_url":"https://github.com/Vahor/interpreter-in-rust","commit_stats":null,"previous_names":["vahor/interpreter-in-rust"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vahor%2Finterpreter-in-rust","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vahor%2Finterpreter-in-rust/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vahor%2Finterpreter-in-rust/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vahor%2Finterpreter-in-rust/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vahor","download_url":"https://codeload.github.com/Vahor/interpreter-in-rust/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243826793,"owners_count":20354221,"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":["ast","interpreter","lexer","parser","rust"],"created_at":"2024-11-22T03:17:56.043Z","updated_at":"2025-03-16T05:13:22.769Z","avatar_url":"https://github.com/Vahor.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Writing an interpreter in _~~Go~~_ **Rust**\n\nhttps://interpreterbook.com/\n\n![Example of Hello World](./.github/images/repl.png)\n\n## Why?\n\nI wanted to read this book and I was learning Rust. So I decided to write the interpreter in Rust.\n\nMy knowledge of Rust is very limited, so I'm sure there are many things that could be done better. I'm open to suggestions and pull requests.\n- In `evaluator.rs` many clones are made, causing multiple issues (push, closure, etc). I'm not sure how to get around this.\n  - I should use refs, but with lifetime etc it's painful.\n\n## How to run\n\n- `cargo test` to run the tests\n- `cargo build --release` to build a release version\n  - The output will be `target/release/interpreter`\n\nOnce built:\n- `interpreter -h` to see the help\n- `interpreter -f \u003cfile\u003e` to run a file\n  - You can fine some files in the `examples` folder\n- `interpreter -e \u003cexpression\u003e` to run an expression\n  - You can run multiple expressions by separating them with a semicolon\n\n## Builtins\n\nYou can find the implementation of the builtins in `evaluator/src/builtins`.\n\n- `len` - returns the length of a string\n- `first` - returns the first element of a list\n- `last` - returns the last element of a list\n- `rest` - returns all elements of a list except the first\n- `push` - adds an element to the end of a list\n- `pop` - removes the last element of a list\n- `print` - prints a value to the console\n- `println` - prints a value to the console with a newline","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahor%2Finterpreter-in-rust","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvahor%2Finterpreter-in-rust","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahor%2Finterpreter-in-rust/lists"}