Crates.io | lamcal |
lib.rs | lamcal |
version | 0.4.0 |
source | src |
created_at | 2018-08-25 06:22:33.648111 |
updated_at | 2018-10-06 04:35:05.704562 |
description | A lambda calculus parser and interpreter |
homepage | https://github.com/haraldmaida/lamcal |
repository | https://github.com/haraldmaida/lamcal |
max_upload_size | |
id | 81200 |
size | 226,983 |
lamcal is a Lambda Calculus parser and evaluator and a separate command line REPL application to play around with lambda expressions interactively. All code is written in Rust.
Highlights:
The library can be used to
parse_str("(λx.(λy.x y) a) b")
parse_str("(\\x.(\\y.x y) a) b")
lam("x", app(var("x"), var("y")))
app!
, e.g.
app![var("a"), var("b"), var("c")]
which is equivalent to
app(app(var("a"), var("b")), var("c))
The separate crate lamcal-repl (crate, github-repository ) provides the command line REPL (read-evaluate-print-loop) application to play around with lambda calculus terms and applying α-conversion and β-reduction interactively.
Features:
Term::reduce
,
that mutates the term in place and a standalone function, e.g. reduce
, that leaves the original
term unchanged and returns the result as a new term.Term
to avoid
stack overflow errors when applied on huge terms. Instead all functions follow the trampolining
pattern.failure
crate compatible error types.To use lamcal as a library in your project add this to your Cargo.toml
file:
[dependencies]
lamcal = "0.4"
and this to your crate root:
extern crate lamcal;
For details about the library see the documentation at crates.io.
This library optionally supports the failure
crate. The support for the failure
crate is a crate
feature. To enable it add the dependency to your Cargo.toml
like so:
[dependencies]
lamcal = { version = "0.4", features = ["failure"] }
Licensed under Apache License, Version 2.0
see LICENSE or http://www.apache.org/licenses/LICENSE-2.0 for details.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be licensed as above, without any additional terms or conditions.