use std::rc::Rc; use std::collections::{BTreeSet,BTreeMap}; use std::fmt; use anyhow::{anyhow,bail,Result}; // This first Simple Lisp really is // // No fexprs, no mutation, no continuations, no macros, no strings. // Int/Bool/Nil/Pair/Symbol/Closure/Prim. // // Figuring out GC between a JIT and Rust will be tricky. // Can start with a like tracing-JIT-into-bytecode // let's make our own Box, Rc, maybe Arc, Vec too? // rustonomicon #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Copy)] pub struct ID { id: i64 } impl fmt::Display for ID { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{}", self.id) } } #[derive(Debug)] pub enum Form { Nil, Int(i32), Bool(bool), Symbol(String), Pair(Rc