A Lispy syntax for Rust.
- Why not?
- To see if it was possible in the current macro system.
- Greenspun's Tenth Rule. It was foreordained.
See the tests for full usage examples.
The tokio_echo
example is runnable:
cargo run --example tokio_echo
Now open another terminal and send data to localhost:12345
; it will be echoed back to you.
To use MacroLisp, import the crate with the #[macro_use]
attribute. You'll also want to bring in the prelude to get operators:
#[macro_use] extern crate macrolisp;
use macrolisp::prelude::*;
All the public symbols in the prelude begin with an underscore, so conflicts should be minimal.
Currently MacroLisp does compile with stable Rust 1.1.0 (and even 1.0.0), but there is some ugliness because stable's implementation of macro_rules!
does not allow token-tree fragments to be followed by sequence repetitions (see rust-lang/rust#25436). This would/will not be necessary with a minimum requirement of beta 1.2.0 and nightly 1.3.0.
One macro!