custom_word/
custom_word.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use stackr_rs::*;

fn main() {
    let code = r#"
    : squared
        "n -- n^2"
        "Squares the top of the stack"
        "2 squared"
        dup *
    ;

    2 squared
    print-stack
    "#;
    let mut interpreter = Interpreter::new(());
    interpreter.evaluate(code, None).unwrap();
}