Skip to main content

elly_core/
lib.rs

1//! Elly — a small language layered on Muon (see `docs/elly-spec.md`).
2//!
3//! This crate implements a subset including references, application, `&` abstraction,
4//! symbols, and positional lists with projection. It uses the `muon` crate for
5//! syntax, parsing into a [`code`] chunk of flat code which a tree-walking evaluator
6//! then runs. Both run in a realm, a [`Ctx`]: the code a realm parses is
7//! evaluated and rendered in that realm.
8//!
9//! ```
10//! let ctx = elly_core::Ctx::new();
11//! let code = ctx.parse("(&x x) .foo").unwrap();
12//! assert_eq!(ctx.eval(code).unwrap().to_display(&ctx), ".foo");
13//! ```
14
15#![no_std]
16
17extern crate alloc;
18#[cfg(feature = "stats-env")]
19extern crate std;
20
21mod builtins;
22pub mod code;
23mod ctx;
24mod eval;
25mod module;
26mod parse;
27mod resolve;
28pub mod source;
29mod sym;
30mod value;
31
32pub use builtins::{Builtin, TyKind};
33pub use code::{ChunkId, HomeLeaf, Text};
34pub use ctx::{parse_fresh, Ctx};
35pub use eval::env::{Env, EnvNode, EnvRef};
36#[cfg(feature = "stats-env")]
37pub use eval::env_stats;
38pub use eval::error::{
39    DocText, FrameName, Raised, Refutation, RefutedBy, ReportStyle, Trace, TraceFrame,
40};
41pub use eval::{apply_with, eval_env, eval_main, instantiate};
42pub use module::{
43    load_module, load_module_source, ImportSpec, Instances, LoadError, ModuleName, ModuleResolver,
44    Resolved,
45};
46pub use parse::{is_bindable_name, Error, ParseError};
47pub use source::{ChunkLoc, ChunkSpan, CtxSpan, Doc, DocSource, Len, Line, Loc, Location, Pos};
48pub use sym::Sym;
49pub use value::{HostCall, HostFn, ObjectData, Value};