Skip to content

API Reference parrot.semantic.accounting.grammar

github-actions[bot] edited this page Dec 2, 2026 · 1 revision

parrot.semantic.accounting.grammar

View source

Closed metric-expression grammar (FEAT-713 M3). Standard library only.

Class BinOp

Binary arithmetic operation.

Parameter Type Default Description
op Literal['+', '-', '*', '/']
left 'Expr'
right 'Expr'

Fields:

Field Type Default Description
op Literal['+', '-', '*', '/']
left 'Expr'
right 'Expr'

Attribute Expr

Alias GrammarError

Re-exported from parrot.semantic.accounting.errors.GrammarError.

Class Neg

Unary minus.

Parameter Type Default Description
operand 'Expr'

Fields:

Field Type Default Description
operand 'Expr'

Class Num

Decimal literal.

Parameter Type Default Description
value Decimal

Fields:

Field Type Default Description
value Decimal

Class Ref

Reference to another metric by name.

Parameter Type Default Description
metric str

Fields:

Field Type Default Description
metric str

Class Sum

sum(set) — total of a named account set.

Parameter Type Default Description
set_name str

Fields:

Field Type Default Description
set_name str

Function parse_assertion

Parse <expr> == <expr>; raise GrammarError otherwise.

parse_assertion(text: str) -> tuple[Expr, Expr]

Parameter Type Default Description
text str

Returns: tuple[Expr, Expr]

Function parse_expr

Parse a metric expression; raise GrammarError(position) on any token outside the grammar.

parse_expr(text: str) -> Expr

Parameter Type Default Description
text str

Returns: Expr

Function references

Return (set_names, metric_names) referenced by expr.

references(expr: Expr) -> tuple[frozenset[str], frozenset[str]]

Parameter Type Default Description
expr Expr

Returns: tuple[frozenset[str], frozenset[str]]

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally