Documentation
¶
Overview ¶
Package syntax parses and formats the compact OpenRealtime graph language. It deliberately contains no type checking or runtime behavior; every frontend lowers into the same elaborator after producing this AST.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Boundary ¶
type Boundary struct {
Direction BoundaryDirection `json:"direction"`
Name string `json:"name"`
Endpoint Endpoint `json:"endpoint"`
Comments []string `json:"comments,omitempty"`
Span Span `json:"span"`
}
Boundary exports an internal port as part of the composite graph contract. Input boundaries bind an internal input; output boundaries bind an internal output. Their types are inferred from that port.
type BoundaryDirection ¶
type BoundaryDirection string
BoundaryDirection is relative to the composite graph.
const ( BoundaryInput BoundaryDirection = "input" BoundaryOutput BoundaryDirection = "output" )
type Delivery ¶
type Delivery string
Delivery is the one ordinary edge-level choice exposed by .ortg.
type Edge ¶
type Edge struct {
Name string `json:"name,omitempty"`
From Endpoint `json:"from"`
To Endpoint `json:"to"`
Delivery Delivery `json:"delivery"`
Comments []string `json:"comments,omitempty"`
Span Span `json:"span"`
}
Edge connects one output port group to one input port group. Name is empty unless the author needs a stable identity independent of its endpoints.
func (Edge) Identity ¶
Identity returns the stable edge identifier emitted into Graph IR. Named edges keep their authored name; unnamed edges are identified by their exact endpoint pair. Keeping this rule on the syntax value prevents compiler and visual-editor mutation paths from inventing subtly different identities.
type Endpoint ¶
type Endpoint struct {
Node string `json:"node"`
Port string `json:"port"`
Span Span `json:"span"`
}
Endpoint refers to a named port group. Variadic lanes are inferred from edges and therefore never appear in source.
type File ¶
type File struct {
Path string `json:"path,omitempty"`
Imports []Import `json:"imports,omitempty"`
Graph Graph `json:"graph"`
}
File is one parsed .ortg source file.
type Graph ¶
type Graph struct {
Name string `json:"name"`
Comments []string `json:"comments,omitempty"`
Statements []Statement `json:"statements,omitempty"`
TrailingComments []string `json:"trailing_comments,omitempty"`
Span Span `json:"span"`
}
Graph is a named element graph. Statement order is preserved for readable formatting; semantic identity is established later by canonical Graph IR.
func (Graph) Boundaries ¶
Boundaries returns declarations in source order.
type Import ¶
type Import struct {
Path string `json:"path"`
Alias string `json:"alias,omitempty"`
Comments []string `json:"comments,omitempty"`
Span Span `json:"span"`
}
Import makes another graph library available to symbolic resolution.
type Node ¶
type Node struct {
Element string `json:"element"`
Name string `json:"name"`
Comments []string `json:"comments,omitempty"`
Span Span `json:"span"`
}
Node instantiates one symbolic element or subgraph contract.
type Position ¶
type Position struct {
Offset int `json:"offset"`
Line int `json:"line"`
Column int `json:"column"`
}
Position identifies one byte location in a source file. Line and Column are one-based; Offset is zero-based.
type Recovery ¶
Recovery is a best-effort immutable syntax snapshot for language tooling. Complete is true only when the strict parser accepted the entire source. A recovered File must never be passed to the graph compiler.
func Recover ¶
func Recover(path string, source []byte, limits RecoveryLimits) (Recovery, error)
Recover lexes an incomplete .ortg buffer and retains only complete, semicolon-terminated statements. It synchronizes at semicolons and the graph closing brace, so one malformed statement cannot manufacture a neighboring declaration. Strict Parse remains the only compilation boundary.
type RecoveryLimits ¶
type RecoveryLimits struct {
MaxSourceBytes int
MaxTokens int
MaxStatements int
MaxDiagnostics int
}
RecoveryLimits bounds the lexer and synchronization work used for an incomplete editor buffer. Recovery is never used by Parse or compilation.
func DefaultRecoveryLimits ¶
func DefaultRecoveryLimits() RecoveryLimits
DefaultRecoveryLimits returns interactive, independently bounded defaults.