Skip to content

lawref.term_sugar

Independent reference lowering for the term sugar (SPEC §86.1).

This is intentionally a small handwritten parser. It does not import, invoke, or otherwise reuse lawc: the point of the module is to give the byte-level differential gate a genuinely independent implementation of DECISION-0101. Only the closed §86.1 surface is accepted; unsupported syntax fails loudly.

Classes

NameDescription
CallNo description.
CaseNo description.
CursorNo description.
LabelNo description.
QuantityNo description.
TermDeclNo description.
TermSyntaxErrorThe source is not in the deliberately narrow §86.1 subset.
TokenNo description.

Functions

NameDescription
lower_termsParse and lower all top-level §86.1 term declarations in source.

Callclassdataclass#

class Call(name: str, args: tuple[object, ...])

argsattributeinstance attribute#

args: tuple[object, ...]

nameattributeinstance attribute#

name: str

Caseclassdataclass#

class Case(name: str, when: tuple[Call, ...], duration: object, labels: tuple[Label, ...])

durationattributeinstance attribute#

duration: object

labelsattributeinstance attribute#

labels: tuple[Label, ...]

nameattributeinstance attribute#

name: str

whenattributeinstance attribute#

when: tuple[Call, ...]

Cursorclass#

class Cursor(tokens: list[Token], at: int = 0, end: int | None = None)

atattributeinstance attribute#

at = at

endattributeinstance attribute#

end = len(tokens) if end is None else end

tokensattributeinstance attribute#

tokens = tokens

identmethod#

def ident() -> str

optionalmethod#

def optional(value: str) -> bool

peekmethod#

def peek(value: str | None = None) -> Token | bool

takemethod#

def take(value: str | None = None) -> Token

Labelclassdataclass#

class Label(language: str, status: str, text: str, forms: tuple[tuple[str, str], ...] = ())

formsattributeclass attributeinstance attribute#

forms: tuple[tuple[str, str], ...] = ()

languageattributeinstance attribute#

language: str

statusattributeinstance attribute#

status: str

textattributeinstance attribute#

text: str

Quantityclassdataclass#

class Quantity(value: str, unit: str)

unitattributeinstance attribute#

unit: str

valueattributeinstance attribute#

value: str

TermDeclclassdataclass#

class TermDecl(name: str, binders: tuple[tuple[str, str], ...], from_: tuple[Call, ...], due: Call, effective: dict | None, default: object, default_labels: tuple[Label, ...], cases: tuple[Case, ...], anchors: tuple[str, ...], public: bool)

anchorsattributeinstance attribute#

anchors: tuple[str, ...]

bindersattributeinstance attribute#

binders: tuple[tuple[str, str], ...]

casesattributeinstance attribute#

cases: tuple[Case, ...]

defaultattributeinstance attribute#

default: object

default_labelsattributeinstance attribute#

default_labels: tuple[Label, ...]

dueattributeinstance attribute#

due: Call

effectiveattributeinstance attribute#

effective: dict | None

from_attributeinstance attribute#

from_: tuple[Call, ...]

nameattributeinstance attribute#

name: str

publicattributeinstance attribute#

public: bool

TermSyntaxErrorclass#

class TermSyntaxError(ValueError)

Bases: ValueError

The source is not in the deliberately narrow §86.1 subset.

Tokenclassdataclass#

class Token(kind: str, text: str, value: str, offset: int)

kindattributeinstance attribute#

kind: str

offsetattributeinstance attribute#

offset: int

textattributeinstance attribute#

text: str

valueattributeinstance attribute#

value: str

lower_termsfunction#

def lower_terms(source: str) -> list[dict]

Parse and lower all top-level §86.1 term declarations in source.

Documentation for Arxo. Writings — blog.arxo.io.

Anonymous visit counts on stats.arxo.io, no cookies.