[][src]Crate parsley

A Scheme parsing and evaluation framework.

Example

use parsley::run;

assert_eq!(
    run("(null? '())").unwrap(),
    run("#t").unwrap()
);

assert_eq!(
    run("(* (+ 3 4 5) (- 5 2))").unwrap(),
    run("36").unwrap()
);

let expr = r#"
(define (sqr x) (* x x))
(define (sum-of-squares x y) (+ (sqr x) (sqr y)))
(sum-of-squares 3 4)
"#;
assert_eq!(
    run(expr).unwrap(),
    run("25").unwrap()
);

Modules

prelude

Quick access to the important stuff.

proc_utils

Utilities for writing LISP procedures in Rust.

Macros

eval

Evaluate one or more S-Expressions, in the base context or your own custom one.

sexp

Construct an S-Expression from a list of expressions.

Structs

Context

Evaluation context for LISP expressions.

Enums

Error

Multipurpose error type.

Num

A numeric type that adapts its precision based on its usage.

SExp

An S-Expression. Can be parsed from a string via FromStr, or constructed programmatically.

Functions

run

Run a code snippet in the base context.

Type Definitions

Result

A shorthand Result type.