ashpaper_plus/lib.rs
1//! # AshPaper
2//! An inpterpreter for the Esopo language AshPaper conceived by [William Hicks](https://github.com/wphicks).
3//! You can read about it and the Esopo project in Willian Hick's own words [here](https://wphicks.github.io/esopo/).
4//! Daniel Temkin also wrote about it on esoteric.codes, you can read that [here](https://esoteric.codes/blog/esopo-turing-complete-poetry).
5//! And of course the spec! Checkout that out [here](https://github.com/wphicks/Esopo/blob/master/AshPaper/informal_specs.txt).
6//!
7//! ## How it works
8//!
9//! You can execute poetry!
10//!
11//! Let's take this poem that calculates factorials and input in the number of syllables in the title.
12//! (I (Shea Newton) learned a lot from reading the poem "other woodwork" by William Hicks)
13//! ```txt
14//! lovely poem
15//!
16//! it is a calculator, like a
17//! poem, is a poem, and finds
18//! factori-
19//! als
20//! The input is the syllAbles
21//! in the title, count them, as one counts
22//! (q) what other poem, programs can be writ
23//! (a) anything a Turing
24//! machine-machine-machine
25//! would do
26//! re/cur
27//! sion works too, in poems, programs, and this
28//! a lovely.
29//! poem or a calculator or nothing
30//! how lovely can it be?
31//! ```
32//! Using this library, you can run it with a program that looked like this:
33//! ```rust
34//! use std::fs;
35//!
36//! use ashpaper_plus::Program;
37//!
38//! pub fn main() {
39//! let contents = "
40//!lovely poem
41//!
42//! it is a calculator, like a
43//! poem, is a poem, and finds
44//! factori-
45//! als
46//! The input is the syllAbles
47//!in the title, count them, as one counts
48//! (q) what other poem, programs can be writ
49//! (a) anything a Turing
50//! machine-machine-machine
51//! would do
52//!re/cur
53//! sion works too, in poems, programs, and this
54//! a lovely.
55//!poem or a calculator or nothing
56//!how lovely can it be?
57//! ";
58//!
59//! let program = Program::create(&contents);
60//! print!("{}", program.execute())
61//! }
62//! ```
63//!
64//! And it will produce the output:
65//! ```txt
66//! 24
67//!
68//! ```
69//!
70//! unlike the original, you can also install the binary from this crate
71//! (you need to enable the cli feature so the executable is built)
72//! ```bash
73//! cargo install --features cli ashpaper-plus
74//! ```
75//!
76//! ## Some caveats about compliance with the informal spec
77//! - It's entirely possible at this point that some of the implementation deviates from the spec in unintended ways. If you spot anything like that, please raise an issue
78mod errors;
79#[cfg(feature = "jit")]
80mod jit;
81mod parser;
82mod program;
83mod rt;
84pub use parser::count_syllables;
85pub use program::Program;