{"id":13771817,"url":"https://github.com/shnewto/ashpaper","last_synced_at":"2025-04-30T15:45:15.923Z","repository":{"id":45106036,"uuid":"179421969","full_name":"shnewto/ashpaper","owner":"shnewto","description":"Rust Inpterpreter for Esopo language AshPaper conceived by William Hicks","archived":false,"fork":false,"pushed_at":"2023-03-20T22:57:39.000Z","size":148,"stargazers_count":14,"open_issues_count":11,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-30T15:45:01.429Z","etag":null,"topics":["ashpaper","crate","crates","crates-io","esolang","esopo","esoteric-interpreter","esoteric-language","esoteric-languages","esoteric-programming-language","interpreter","literature","poem","poetry","rust","rust-bin","rust-lang","rust-library","syllables"],"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/shnewto.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2019-04-04T04:33:36.000Z","updated_at":"2025-04-26T16:16:58.000Z","dependencies_parsed_at":"2024-02-12T04:34:53.857Z","dependency_job_id":"c0c9e291-ea4b-4693-b0d5-cd0e5a755e53","html_url":"https://github.com/shnewto/ashpaper","commit_stats":{"total_commits":103,"total_committers":5,"mean_commits":20.6,"dds":"0.058252427184465994","last_synced_commit":"ca3d39168b0a2b8c14c7d150a668c5dd2ca97d51"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnewto%2Fashpaper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnewto%2Fashpaper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnewto%2Fashpaper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shnewto%2Fashpaper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shnewto","download_url":"https://codeload.github.com/shnewto/ashpaper/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251734044,"owners_count":21635062,"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":["ashpaper","crate","crates","crates-io","esolang","esopo","esoteric-interpreter","esoteric-language","esoteric-languages","esoteric-programming-language","interpreter","literature","poem","poetry","rust","rust-bin","rust-lang","rust-library","syllables"],"created_at":"2024-08-03T17:00:55.915Z","updated_at":"2025-04-30T15:45:15.869Z","avatar_url":"https://github.com/shnewto.png","language":"Rust","funding_links":[],"categories":["Projects"],"sub_categories":[],"readme":"[![.github/workflows/ci.yml](https://github.com/shnewto/ashpaper/workflows/.github/workflows/ci.yml/badge.svg?branch=main)](https://github.com/shnewto/ashpaper/actions)\n[![codecov](https://codecov.io/gh/shnewto/ashpaper/branch/main/graph/badge.svg?token=koBLxpVvcw)](https://codecov.io/gh/shnewto/ashpaper)\n[![Crates.io Version](https://img.shields.io/crates/v/ashpaper.svg)](https://crates.io/crates/ashpaper)\n[![Crates.io](https://img.shields.io/crates/d/ashpaper.svg)](https://crates.io/crates/ashpaper)\n\n# AshPaper\nAn inpterpreter for the Esopo language AshPaper conceived by [William Hicks](https://github.com/wphicks). You can read about it and the Esopo project in Willian Hick's own words [here](https://wphicks.github.io/esopo/). Daniel Temkin also wrote about it on esoteric.codes, you can read that [here](https://esoteric.codes/blog/esopo-turing-complete-poetry). And of course the spec! Checkout that out [here](https://github.com/wphicks/Esopo/blob/master/AshPaper/informal_specs.txt).\n\n## How it works\n\nPoetry is your program.\n\nYou have two registers at your disposal, r0 and r1 which store signed integers (`i64`).\nYou also have an stack which can store signed integers (bounds are only that of `Vec\u003ci64\u003e`).\n\nHere are the instructions at your disposal (in order that they get precedence):\n- _End rhyme with previous line_: Unimplemented.\n- Line contains `/`: If the value in the active register is greater than the number of syllables in the line, go to the line number that corresponds to the value in the **non-active** register. If abs(n) \u003c= lines then n, else n % lines.\n- _Capital letter appears inside a word_: Negate the active register.\n- _Capital letter appears at the beginning of a word_: Multiply registers and store result in the active register.\n- _Line contains the words 'like' or 'as'_: Add registers and store in the active register.\n- _Line contains `?`_: Print ASCII character associated with value of the active register. If abs(n) \u003c= u8::MAX n, else n % u8::MAX.\n- _Line contains `.`_: Print integer value of the active register.\n- _Line contains `,`_: Pop from the stack and store in the active register.\n- _Line contains `-`_: Push the value of the active register to the stack.\n- _Alleteration of consecutive words_: Unimplemented.\n- _Blank line_: no-op.\n- _Everything else_: Store number of syllables in the line to the active register.\n\n\nLet's take this poem in a file called `lovely-poem.eso`. This poem-program (poegram‽) calculates factorials and input in the number of syllables in the title. (I learned a lot from reading the poem \"other woodwork\" by William Hicks)\n```txt\nlovely poem\n\n  it is a calculator, like a\n      poem, is a poem, and finds\n        factori-\n          als\n  The input is the syllAbles\nin the title, count them, as one counts\n  (q) what other poem, programs can be writ\n  (a) anything a Turing\n    machine-machine-machine\n    would do\nre/cur\n    sion works too, in poems, programs, and this\n       a lovely.\npoem or a calculator or nothing\nhow lovely can it be?\n```\nUsing this library, you can run it with a program that looked like this:\n```rust\nextern crate ashpaper;\n\nuse std::fs;\n\npub fn main() {\n    let fname = \"lovely-poem.eso\";\n    let contents = fs::read_to_string(fname).expect(\"Something went wrong reading input file!\");\n    match ashpaper::program::execute(\u0026contents) {\n        Ok(res) =\u003e print!(\"{}\", res),\n        Err(e) =\u003e eprintln!(\"{}\", e),\n    }\n}\n```\n\nAnd it will produce the following String:\n```txt\n24\n```\n\nWhen `RUST_LOG=info` is set and the caller initializes logging, you can get at program evaluation info. Here's what `lovely-poem.eso` looks like.\n```txt\ninstruction                                         |  r0  |  r1  |  stack\n--------------------------------------------------- | ---- | ---- | -------\nlovely poem                                         |  4   |  0   | []\n                                                    |  4   |  0   | []\n  it is a calculator, like a                        |  4   |  4   | []\n      poem, is a poem, and finds                    |  4   |  4   | []\n        factori-                                    |  4   |  4   | [4]\n          als                                       |  4   |  1   | [4]\n  The input is the syllAbles                        |  4   |  -1  | [4]\nin the title, count them, as one counts             |  3   |  -1  | [4]\n  (q) what other poem, programs can be writ         |  3   |  4   | []\n  (a) anything a Turing                             |  3   |  12  | []\n    machine-machine-machine                         |  3   |  12  | [12]\n    would do                                        |  3   |  2   | [12]\n  it is a calculator, like a                        |  3   |  5   | [12]\n      poem, is a poem, and finds                    |  3   |  12  | []\n        factori-                                    |  3   |  12  | [12]\n          als                                       |  3   |  1   | [12]\n  The input is the syllAbles                        |  3   |  -1  | [12]\nin the title, count them, as one counts             |  2   |  -1  | [12]\n  (q) what other poem, programs can be writ         |  2   |  12  | []\n  (a) anything a Turing                             |  2   |  24  | []\n    machine-machine-machine                         |  2   |  24  | [24]\n    would do                                        |  2   |  2   | [24]\nre/cur                                              |  2   |  2   | [24]\n    sion works too, in poems, programs, and this    |  2   |  24  | []\n       a lovely.                                    |  2   |  24  | []\npoem or a calculator or nothing                     |  10  |  24  | []\nhow lovely can it be?                               |  10  |  24  | []\n```\n\n## Some caveats about compliance with the informal spec\n- It is possible at this point that my implementation deviates from the spec in unintended ways. If you spot anything like that, please raise an issue :heart: :heart:\n- The alliteration and rhyming rules are still unimplemented.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshnewto%2Fashpaper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshnewto%2Fashpaper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshnewto%2Fashpaper/lists"}