Galixir.GeneratorBehaviour behaviour (galixir v0.23.0)

Copy Markdown View Source

Defines the behaviour contract for Galixir code generators.

A generator module is responsible for producing the implementation AST that is injected into generated algebra modules during compilation.

Each generator receives a Galixir.Meta structure containing the information required to generate code for a specific algebra, such as its dimension, signature, basis blades, and precomputed lookup tables.

Implementations must return a list of quoted expressions (Macro.t()) that can be inserted into the target module using unquote_splicing/1.

This behaviour allows individual generators to be developed independently while providing a common interface for composing complete algebra implementations.

Summary

Types

meta()

@type meta() :: %Galixir.Meta{
  bases: term(),
  blade_aliases: term(),
  blade_indices: term(),
  dimensions: term(),
  module: term(),
  signature: term(),
  size: term(),
  table: term()
}

Callbacks

generate_implementation(arg)

@callback generate_implementation(arg :: meta()) :: [Macro.t()]