PtcRunner.Lisp.Analyze (PtcRunner v0.10.1)

Copy Markdown View Source

Validates and desugars RawAST into CoreAST.

The analyzer transforms the parser's output (RawAST) into a validated, desugared intermediate form (CoreAST) that the interpreter can safely evaluate.

Error Handling

Returns {:ok, CoreAST.t()} on success or {:error, error_reason()} on failure.

Summary

Functions

Returns the canonical list of all forms handled by the analyzer.

Types

error_reason()

@type error_reason() ::
  {:invalid_form, String.t()}
  | {:invalid_arity, atom(), String.t()}
  | {:invalid_where_form, String.t()}
  | {:invalid_where_operator, atom()}
  | {:invalid_cond_form, String.t()}
  | {:invalid_thread_form, atom(), String.t()}
  | {:unsupported_pattern, term()}
  | {:invalid_placeholder, atom()}

Functions

analyze(raw_ast)

@spec analyze(term()) :: {:ok, PtcRunner.Lisp.CoreAST.t()} | {:error, error_reason()}

supported_forms()

@spec supported_forms() :: [atom()]

Returns the canonical list of all forms handled by the analyzer.

These are forms dispatched via dispatch_list_form/4 — special forms, macros, predicate builders, and control flow that the analyzer intercepts before the interpreter sees them.

Examples

iex> :let in PtcRunner.Lisp.Analyze.supported_forms()
true

iex> :filter in PtcRunner.Lisp.Analyze.supported_forms()
false