Compiles WPL-AI AST to canonical WPL JSON format.
The compiler transforms the parsed AST representation into the WPL JSON structure used by the rest of the system.
Example
iex> {:ok, ast} = WPLAI.parse(source)
iex> {:ok, json} = Compiler.compile(ast)
iex> json.plan.name
"Upper Body Beginner"
Summary
Functions
Compile a WPL-AI AST document to WPL JSON format.
Compile a WPL-AI AST document to WPL JSON format, raising on error.
Functions
@spec compile(WplAi.AST.Document.t()) :: {:ok, map()} | {:error, list()}
Compile a WPL-AI AST document to WPL JSON format.
Returns {:ok, json_map} on success, or {:error, errors} on failure.
@spec compile!(WplAi.AST.Document.t()) :: map()
Compile a WPL-AI AST document to WPL JSON format, raising on error.