Declarative macros

https://doc.rust-lang.org/book/ch19-06-macros.html

We have seen a peculiar syntax in the form of println!(). All things in the shape of name!(), name![] or name!{} are macro invocations. Macros are structures that take source code (tokens) as input and expand to more code.

// This is a simple macro named `say_hello`.
macro_rules! say_hello {
    // `()` indicates that the macro takes no argument.
    () => {
        // The macro will expand into the contents of this block.
        println!("Hello!");
    };
}

fn main() {
    // This call will expand into `println!("Hello");`
    say_hello!()
}

example borrowed from: https://doc.rust-lang.org/rust-by-example/macros.html

More complex rules can be utilized which allow for more sophisticated transformation of input tokens. Macros can also be recursive.