Elixir implementation of the OpenUI 1.0 Language specification (openui-lang).
Provides a zero-dependency lexer, Pratt expression parser, schema-aware materializer, incremental streaming parser, runtime evaluator, statement patch merger, serializer, form validation rules, message protocol parser, and system prompt generator.
Summary
Functions
Auto-closes unclosed strings and brackets in a partial openui-lang string.
Builds an OpenUI wire message with ]]>openui: section markers.
Compiles a decoded LibrarySpec (or JSON Schema map) into a compiled catalog (cat)
for use with parse/3, stream_parser/2, evaluate_result/2, and json_to_openui/3.
Decodes a JSON string while preserving object key insertion order in "__keys__".
Required when loading a LibrarySpec JSON file so positional argument order matches
the JSON Schema property order.
Demultiplexes mixed conversational Markdown prose and openui-lang code blocks.
Returns %{prose: String.t(), code: String.t()}.
Evaluates a single AST node with the given evaluation context.
Evaluates a ParseResult and returns the canonical OpenUI result map
(root, tree, errors, errorObjects, unresolved, orphans, incomplete, state).
Generates a system prompt for an LLM from a LibrarySpec map.
Serializes an ElementNode tree back to openui-lang source text.
Merges an existing openui-lang program with a statement patch and garbage-collects
statements unreachable from root_id.
Parses a complete or partial openui-lang source string in one batch pass.
Parses a token list into an AST expression node.
Parses an OpenUI wire message with ]]>openui: section markers.
Parses an openui-lang source string (complete or mid-stream partial) into a flat
symbol table map %{"root" => {"Panel", [...]}, "$var" => "default", ...} for TUI
forward-reference resolution, 80-column layout clamping, and live $live_* bindings.
Pushes a streamed chunk into the streaming parser and returns {parse_result, updated_stream_parser}.
Creates a new stateful OpenUILang.Parser streaming parser struct.
Tokenizes an openui-lang source string into a flat token list.
Validates a form value against structured validation rules.
Returns nil when valid, or an error string when invalid.
Functions
Auto-closes unclosed strings and brackets in a partial openui-lang string.
Builds an OpenUI wire message with ]]>openui: section markers.
Compiles a decoded LibrarySpec (or JSON Schema map) into a compiled catalog (cat)
for use with parse/3, stream_parser/2, evaluate_result/2, and json_to_openui/3.
Decodes a JSON string while preserving object key insertion order in "__keys__".
Required when loading a LibrarySpec JSON file so positional argument order matches
the JSON Schema property order.
Demultiplexes mixed conversational Markdown prose and openui-lang code blocks.
Returns %{prose: String.t(), code: String.t()}.
Evaluates a single AST node with the given evaluation context.
Evaluates a ParseResult and returns the canonical OpenUI result map
(root, tree, errors, errorObjects, unresolved, orphans, incomplete, state).
Generates a system prompt for an LLM from a LibrarySpec map.
Serializes an ElementNode tree back to openui-lang source text.
Merges an existing openui-lang program with a statement patch and garbage-collects
statements unreachable from root_id.
Parses a complete or partial openui-lang source string in one batch pass.
Parses a token list into an AST expression node.
Parses an OpenUI wire message with ]]>openui: section markers.
Parses an openui-lang source string (complete or mid-stream partial) into a flat
symbol table map %{"root" => {"Panel", [...]}, "$var" => "default", ...} for TUI
forward-reference resolution, 80-column layout clamping, and live $live_* bindings.
Pushes a streamed chunk into the streaming parser and returns {parse_result, updated_stream_parser}.
Creates a new stateful OpenUILang.Parser streaming parser struct.
Tokenizes an openui-lang source string into a flat token list.
Validates a form value against structured validation rules.
Returns nil when valid, or an error string when invalid.