lower

Crates.iolower
lib.rslower
version0.1.1
sourcesrc
created_at2024-02-17 01:18:49.601244
updated_at2024-02-18 00:21:59.112243
descriptiondesugar math where the compiler wont
homepage
repositoryhttps://github.com/bend-n/lower.git
max_upload_size
id1142927
size13,985
bendn (bend-n)

documentation

README

lower

lowers expressions to their "desugared" form.

e.g

a * b + c => (a.mul(b)).add(c)

note that it is extremely pervasive, so

lower::math! { fn main() -> u8 {
    const X: u8 = 31 * 2;
    return 2 * X + 2;
} }

expands to

fn main() -> u8 {
    const X: u8 = 31.mul(2);
    return (2.mul(X)).add(2);
}

it should work for most expressions.

why

well, you see, i made a crate for arrays. then, i added add/mul/…, and got annoyed when i had to call them manually. now, you can do amazing things such as lower::math! { 2 * ([5, 2] + 5) }.

Commit count: 0

cargo fmt