Expand description
§macroscript
This is a full reimplementation of Robot Is Chill’s macro-based programming language.
§Changes
A few things have been changed between RIC’s implementation and this one. The most notable ones include:
- Numbers are limited to f64s (no complex numbers)
- No runtime limits
- More builtin macros (check the docs!)
- Text macros (e.g.
double: [multiply/$1/2]
) aren’t included by default- In order to use text macros, they have to be added using
TextMacro
.
- In order to use text macros, they have to be added using
§Example
use macroscript::{apply_macros, add_stdlib};
use std::collections::HashMap;
fn main() {
let mut macros = HashMap::new();
add_stdlib(&mut macros);
let input = "[add/5/3]".to_string();
let result = apply_macros(input, ¯os).unwrap();
assert_eq!(result, "8");
}
Re-exports§
pub use execution::Macro;
pub use execution::MacroError;
pub use execution::MacroErrorKind;
pub use execution::apply_macros;
pub use stdlib::add as add_stdlib;
pub use textmacro::TextMacro;