Crate unlambda

Source
Expand description

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§

Modules§

  • Evaluation API. By far ths most useful part of this crate.
  • The interpreter guts, mostly.
  • Various input and output types.
  • The parse API. Somewhat useful.

Structs§

  • 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.