Skip to main content

rucc_base/
lib.rs

1//! Arenas, interning, index newtypes and the small data structures the rest of the
2//! compiler is built out of.
3//!
4//! Design: `spec/03-architecture.md`. Layer rank 0, see `spec/18-package-layout.md`.
5//!
6//! Nothing in here knows anything about C. That is deliberate: this is the one crate every
7//! other crate depends on, so anything C-specific that leaks in here becomes impossible to
8//! avoid later.
9//!
10//! [`float`] is here for the same reason. Binary floating point is not a C question, and both
11//! ends of the compiler need the same answer to it: the lexer converting a constant and the
12//! optimizer folding one have to agree to the last bit, and neither may ask the host what a
13//! number means, because the same source has to give the same bits whoever compiles it.
14//!
15//! # Status
16//!
17//! The index newtypes, the interner and the software float are real and used. The arena is a
18//! thin wrapper for now and grows with `M2`. The float has both halves of what a constant needs:
19//! conversion from text, and the arithmetic the constant evaluator folds with, each of them
20//! correctly rounded and neither of them asking the host anything.
21//!
22//! This crate is tier 3 in `spec/18-package-layout.md` section 18.5: its Rust API is
23//! explicitly unstable and will change without a major version bump.
24
25#![doc(html_root_url = "https://docs.rs/rucc-base/0.2.9")]
26
27mod decimal;
28pub mod float;
29pub mod index;
30pub mod intern;
31mod scope;
32
33pub use index::{Idx, IdxRange};
34pub use intern::{Interner, Symbol};
35pub use scope::ScopeMap;