macro_rules! sexpr {
{ $(;)? } => { ... };
{ ; { $($head:tt)* } } => { ... };
{ ; @ {$($head:tt)*} $(= $val:expr)? } => { ... };
{ ; @ $head:ty $(= $val:expr)? } => { ... };
{ ; $head:ty } => { ... };
{ { $($head:tt)* } ; $($tail:tt)+ } => { ... };
{ @ {$($head:tt)*} $(= $val:expr)? ; $($tail:tt)+ } => { ... };
{ @ $head:ty $(= $val:expr)?; $($tail:tt)+ } => { ... };
{ $head:ty ; $($tail:tt)+ } => { ... };
{ { $($head:tt)* } $(, $($tail:tt)*)? } => { ... };
{ @ {$($head:tt)*} $(= $val:expr)? $(, $($tail:tt)*)? } => { ... };
{ @ $head:ty $(= $val:expr)? $(, $($tail:tt)*)? } => { ... };
{ $head:ty $(, $($tail:tt)*)? } => { ... };
}Expand description
sexprs, the building blocks of everything Lisp
This crate uses an unusal sexpression syntax in order to be Rust-compatible:
- Curly braces
{}are used for delimiters instead of parentheses - Terms are separated by commas instead of whitespace
- The quote character is
@ - Atoms are arbitrary Rust types
- The final comma can be replaced by
;to suppress the automaticHNil