zdimension / macro-forth

Compile-time const Forth evaluation with macros

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

macro-forth

Forth, in macros.

fn main() {
    const TWO: i32 = forth!(5 3 -);
    forth!(
        TWO . // 2
    );

    const HUNDRED: i8 = forth!(
        1 2 dup * + dup + // 10
        dup * // 100
        hundred !
        3 dup swap drop drop
        hundred @
    );

    forth!(
        HUNDRED @ dup . // 100
        50 > if "bigger" else "smaller" then . // bigger
    );
}

About

Compile-time const Forth evaluation with macros

License:MIT License


Languages

Language:Rust 100.0%