WplAi.Parser (WPL-AI v1.6.6)

Copy Markdown View Source

Parser for WPL-AI language.

Builds an AST from tokens produced by the Lexer. Uses recursive descent parsing.

Summary

Functions

Parse WPL-AI source text into an AST.

Parse tokens into an AST (for testing with pre-tokenized input).

Types

parse_state()

@type parse_state() :: %{
  tokens: [WplAi.Lexer.token()],
  pos: non_neg_integer(),
  errors: [WplAi.Errors.ParseError.t()]
}

Functions

parse(source)

@spec parse(String.t()) :: {:ok, WplAi.AST.Document.t()} | {:error, list()}

Parse WPL-AI source text into an AST.

Returns {:ok, AST.Document.t()} or {:error, errors}.

parse_tokens(tokens)

@spec parse_tokens([WplAi.Lexer.token()]) ::
  {:ok, WplAi.AST.Document.t()} | {:error, list()}

Parse tokens into an AST (for testing with pre-tokenized input).