#programming-language #macro #macro-based #run-time #robot #chill #numbers

nightly macroscript

A reimplementation of my macroscript programming language

3 unstable releases

0.6.0 Jul 5, 2024
0.5.1 Jul 5, 2024
0.5.0 Jul 5, 2024

#582 in Programming languages

MIT license

72KB
1K SLoC

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.

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, &macros).unwrap();
  assert_eq!(result, "8");
}

Dependencies

~3–4.5MB
~75K SLoC