[][src]Crate unlambda

Unlambda interpreter library.

Written on a whim. I had intended to write a rust unlambda binary, and maybe I'll get to that but this project does nobody any good sitting in my ~/code folder.

It's rough around the edges and the docs are almost non-existent. The important parts of the api are exposed at the top level but it's been long enough since I looked that really I just fixed obvious warts and exposed more-or-less everything. If you want to use a library to evaluate unlambda, then far be it from me to stop you from getting deep into my code's guts.

Example

use unlambda::Input;
let source = "`.!`.d`.l`.r`.o`.w`. `.,`.o`.l`.l`.e`.Hi";
// `unlambda::Input` is the "stdin", which can be a string,
// a file, actual stdin, ... It defaults to the empty string.
let input = unlambda::Input::default();
// Produces an error if we fail to parse, or if the
// unlambda program does some IO which itself produces an error.
let output = unlambda::eval_to_string(source, input)?;
assert_eq!(output, "Hello, world!");

Re-exports

pub use eval::eval_to_stdout;
pub use eval::eval_to_string;
pub use eval::eval_to_vec;
pub use eval::Error as EvalError;
pub use io::Input;
pub use parse::parse_from_file;
pub use parse::parse_from_reader;
pub use parse::parse_from_stdin;
pub use parse::parse_from_str;
pub use parse::ParseError;

Modules

eval

Evaluation API. By far ths most useful part of this crate.

internals

The interpreter guts, mostly.

io

Various input and output types.

parse

The parse API. Somewhat useful.

Structs

P

This type is a quick hack to paper over a mistake where apparently I exposed Arc vs Rc based on a cfg(feature = "arc") setting. It was very easy to write code that breaks when that feature changes, so now there's a hacky/minimal wrapper.