# Using the Macros
## Module setup
```rust
#[reefer::algebra(f32, 3, 1)]
mod cga2d {
basis! { e0 = P0 + N0 }
basis! { eI = P0 - N0 }
basis! { e1 = P1 }
basis! { e2 = P2 }
#[derive(Debug, Clone, Copy, PartialEq)]
shape!(Vector { e0, eI, e1, e2 });
}
```
## Basis and shape declarations
- Alias grammar matches `[a-z]+[0-9A-Z]?` and must remain prefix-free (`e1`, `e12`, `rotorA`).
- Frame slots on the right-hand side stick to the uppercase `[PN]\d+` (shorthand `[PQ]\d+]`) pattern such as `P0`, `N1`, so the parser cleanly separates them from alias names. These frame slots are the basis of the compile time mother algebra.
- Basis aliases may include scalar coefficients: `basis! { idem = 0.5 + 0.5 * P0 }`.
- Compound aliases such as `e12` or `t0x1` are expanded automatically using the alias map.
- Shapes enumerate chosen blades; at expansion time each `shape!` becomes a public struct populated with scalar fields.
## Expressions
Use the generated `expr!` macro to define typed closures:
```rust ignore
```
Supported operators: `*`, `^`, `|`, `&`.
Supported methods:
- `reverse`, `conjugate`, `automorphism` (involutions)
- `dual`, `complement`, `scalar`, `norm_squared`
- `left_contract`, `right_contract`
- `sandwich`, `exp`, `sqrt`
Unsupported today: arbitrary function calls, method chains with arguments other than the documented list, or pattern `let` bindings inside the closure. The optimizer will report unsupported syntax at compile time.