Glossary
The terms of this specification in alphabetical order. Each entry gives a short definition and the place where the term is defined.
| Term | Meaning |
|---|---|
| action | An umbrella term for a Predicate Action and a Value Action. See Actions. |
| abstract machine | The machine that every runtime hosts: the state of a parse and the operations that change it. See The Abstract Machine. |
| Action dialect | The operations of Code IR on the values of action expressions, legal at the Flow and the Exec stage. See Values. |
| Action Expression | A value-level expression evaluated inside a Predicate Action or Value Action. See Actions. |
| anchor | A Rule Expression that matches a position without consuming input and has no value: ^^, $$, ^, $. See Anchors. |
| atomic | a #atomic: matches a and produces a single string node. See Atomic. |
| attribute | An @ annotation for diagnostics or metadata, such as @error(...); it does not change matching behavior. See Attributes. |
| binding level | One precedence level of an Operators Rule, declared with level. Levels declared earlier bind more loosely. See Operators Rule. |
| capture | A Rule Expression label:a that names the element a as label, so that an action can read it as $label. See Capture. |
| character class | [...] or [^...]: matches one code point from a set of characters and ranges. See Character Matching. |
| choice | a / b: an ordered choice, which commits to the first alternative that succeeds. See Ordered choice. |
| code point | A Unicode code point; the unit in which the input is matched. See Input and positions. |
| compiled grammar | A grammar saved as a .sxirc file holding the bytecode of one mode (parse, recognize or document), with no grammar AST, that loads without parsing grammar source. See Compiled Grammars. |
| Code IR | The form of the code that a grammar is compiled to and that the runtimes are written in: modules of types, state and operations, and functions of structured code over them, at the Flow or the Exec stage. See SyntaxIR Code IR Specification. |
| composition | A function at the Exec stage of Code IR that every runtime shares, written once over the operations of the abstract machine, such as the call protocol of a rule. See Compositions. |
| concrete syntax tree (CST) | The tree of nodes that Rule Expressions produce when no action is involved: string nodes, tuples for sequences and lists for repetitions. See Values and the concrete syntax tree. |
| contextual word | A grammar word interpreted as syntax only in a Declaration Statement or Operators Rule position; the same spelling may be an identifier elsewhere. See Contextual Words. |
| Core IR | The intermediate representation of a checked grammar, whose nodes make their effects explicit. See SyntaxIR Core IR Specification. |
| cost | What a parse spends: the rule bodies evaluated, the input examined, the iterations and operators applied and the size of the values built. Time is proportional to it, and the budget caps it, in compute units. See Time and Memory. |
| cut | #cut: commits the enclosing choice to the current alternative. See Cut. |
| Declaration Statement | A Type Declaration Statement or Rule Declaration Statement in a .sxir file. See Grammar Files. |
| diagnostic | A syntax error that a parse reports with its position and expectations; a recovered parse and a Document publish them as caller-owned values, and a stream delivers them through diagnostic options. See Syntax Errors and Incremental Documents. |
| dialect | A named set of operations of Code IR with their contracts: Flow, Action or Exec. See Dialects and Stages. |
| discard | -a: matches a and has no value. See Discard. |
| Document | A mutable text together with its parse result, updated by edits and reparsed incrementally. See Incremental Documents. |
| edit | The replacement of a range of a Document's text; the next parse reuses the results that the edit did not affect. See Edits. |
| edit sequence | A replayable edit history for one grammar: an initial text and edit, undo, redo and checkpoint operations, saved as a versioned JSON file. See Edit Fuzzing. |
| effect | One thing a Core IR node can do besides succeed or fail, such as consuming input, recording expectations or writing a capture. See Attributes and Effects. |
| Exec dialect | The operations of the abstract machine, with the compositions written over them; with the Action dialect it is what Code IR at the Exec stage calls. See SyntaxIR Exec Dialect Specification. |
| expectation | An item that a syntax error lists as expected at a position: a literal, a character class, any character or an anchor. A parse records expectations only on request. See Recording expectations. |
| farthest failure | The farthest position at which parsing failed, with the items expected there when the parse records expectations; the syntax error reports it. See Syntax errors. |
| finding | One report of the linter: a position, a severity, the name of a check, a message and, if there is one, a fix. See Grammar Lint. |
| fixture suite | A versioned JSON file of named inputs with expected outcomes and goldens, run by sxir test. See Fixture Suites and Edit Sequences. |
| Flow dialect | The operations that say how a parser runs a rule: matching, backtracking, expectations, rule calls, values and charges; Code IR at the Flow stage calls them. See SyntaxIR Flow Dialect Specification. |
| fragment | A part of a text that is parsed alone: a prefix parse matches the start rule at the beginning of a supplied string, which the caller confines by slicing both ends. See Prefix Parsing. |
| generated parser | A standalone Go or TypeScript parser written for one grammar by sxir gen. See Generated Parsers. |
| grammar | An optional package clause followed by Type and Rule Declaration Statements, normally written in a .sxir file. See Grammar Files. |
| grammar source | One named input in grammar syntax or JSON that grammar.Load reads into a grammar AST. See Grammar Sources. |
| join type | The join T | U of types: a type whose values are the values of any one of its member types. See Join Types. |
| left recursion | A rule that calls itself at the position where it started. It is evaluated by growing a seed. See Left recursion. |
| limit, budget | A bound on one invocation: Compute (the cost of the parse, in compute units), Memory (bytes of storage), Input (length of the input) and Depth (nesting of recursive rule calls). The compute budget is the amount of compute units that the limit allows. See Limits. |
| lookahead | &a and !a: tests the input that follows without consuming it. See Lookahead. |
| meet type | The meet T & U of types: a type whose values are the values of both. See Top, Bottom, Join and Meet. |
| memoization | Caching the result of a rule at an input position so that the rule is not evaluated twice at that position (packrat parsing). See Memoization. |
| named node type | A Type Definition type N = node[U]: a type distinct from node[U] and from every other named node type. Its values are nodes that carry the name N. See Named Node Types. |
| near-miss invalid input | An input that the parser accepts, changed by one mutation so that it rejects it. See Input Generation. |
| node | A value together with the range of input that it covers: a string, a tuple or a list. See Nodes and Values. |
| operand, operator | The parts of an Operators Rule: an operand is the leading element of an expression, an operator is a prefix, infix or postfix form. See Operators Rule. |
| operation | A transition of the abstract state of a parse that a dialect of Code IR declares, with a contract and a cost bound. See The Module. |
| Operators Rule | A rule declaration that declares operators by precedence and associativity. See Operators Rule. |
| output schema | The description of the values a grammar can produce: its declared types and the inferred value shape of each rule, exported without parsing input. See Output Schemas. |
| position | A number that identifies a place between two characters of the input, counted in the position unit. See Input and positions. |
| position unit | The unit in which positions and lengths in the input are measured: code points or bytes. See Input and positions. |
| pragma | A # annotation that changes expression behavior or structure, such as #atomic, #recover, #repeat(...) or #stream, which follow an expression, and #cut, which stands in place of one. See Pragmas. |
| predicate | A Rule Expression { expr } that evaluates a Predicate Action without consuming input; a single expression retains the established predicate semantics. See Predicates and Variables. |
| Predicate Action | { expr }: an action in a Rule Expression that evaluates without consuming input or producing a value, and fails if the result is false or an error. See Predicates and Variables. |
| prefix parse | A parse that matches the start rule at the beginning of the input and reports how much it consumed, instead of requiring the whole input. See Prefix Parsing. |
| public package | A Go package under syntaxir.dev/sxir/pkg; together they are the Go API. See Go Packages. |
| range | The pair of positions [start, end) that a node covers. See Nodes and Values. |
| recognition | Recognition decides whether the input matches the grammar without building a tree. It returns the same success, failure and syntax errors as a parse, recovered errors included. Predicates, and the actions they read, run; the run-time errors of other actions and typed conversions are not checked. See Modes. |
| recovery | #recover: after a failure in an element, skips input to a synchronization point, keeps an error value and continues. See #recover. |
| rule | A named Rule Expression, defined with rule <name> [<Type Expression>] = <Rule Expression>. A rule produces a single value when it matches. See Rule Declaration Statements. |
| Rule Declaration Statement | A statement rule ... that declares a rule: a Rule Definition. See Rule Declaration Statements. |
| Rule Definition | rule a = b: defines the rule a by a Rule Expression or an Operators Rule. See Rule Declaration Statements. |
| Rule Expression | An expression that matches input; the body of an ordinary rule. See Rule Expressions. |
| scope | The place where captures are visible: a rule body or one iteration of a repetition. See Capture. |
| sequence | a b: matches a and then b. See Sequence. |
| skip run | The walks of a skip-run site: an unbounded repetition written in the skip expression of a #recover, whose walks the parser records and reuses. See Skip Runs. |
| snapshot | An immutable capture of one revision of a Document: its text, parse outcome and value graph. See Snapshots. |
| source information | An opt-in record of the rule that produced each node and of the names of captures. See Source Information. |
| specialization | A copy of a function of Code IR at the Exec stage in which each feature is fixed on or off. See Specialization. |
| stage | The form that a module of Code IR is in, Flow or Exec, which lists the dialects whose operations may appear in it. See Dialects and Stages. |
| start rule | The rule with which parsing begins. It is chosen when the grammar is compiled or parsed, not in the grammar file. See Start rule. |
| stream | A #stream repetition whose elements are handed to the caller as soon as they match, so that earlier input can be released. See Streaming. |
| string node | A node whose value is the matched input text: the node of a literal, a character class, . or an atomic expression. Its type is node[string]. See Nodes and Values. |
| struct type | A user-defined type of values with named fields, which an action builds. See Struct types. |
| terminal | A string node. Node.IsTerminal reports it. See Nodes and Values. |
| token | A lexical element of a grammar file: an identifier, a literal, a capture reference or punctuation. See Tokens. |
| trace, profile | A trace reports every rule call of a parse, at its start and its end, to a callback; a profile totals the cost of each rule. Both are opt-in and never change what the parser accepts or returns. See Tracing and Profiling. |
| trivia rule | A rule whose body is a greedy repetition of an element that cannot match nothing by its form, such as the whitespace of a grammar, and that runs no action. See Conditions for Linear Cost. |
| tuple | The value of a sequence: the values of its elements, in order. A rule without a valued element produces the empty tuple, the unit (). See Nodes and Values. |
| Type Alias | type a ~ b: gives the type b another name a, and defines no type. See Type Aliases. |
| Type Declaration Statement | A statement type ... that declares a type name: a Type Definition or a Type Alias. See Type Declaration Statements. |
| Type Definition | type a = b: defines a new type a, distinct from every other type. See Type Definitions. |
| Type Expression | An expression that specifies a type, including the declared value type of a rule or the right-hand side of a Type Declaration Statement. See Type System. |
| validate, validation | The structural check of an artifact that a program built or loaded: a grammar AST (grammar.Validate), an output schema (schema.Output.Validate) or a bytecode module (bytecode.ValidateModule). Checking whether an input matches a grammar is not validation but recognition or parsing. See Validation of a Grammar AST. |
| value | What a Rule Expression, a rule or an action produces: a node, nil, an error value, a struct, or an integer, string or boolean inside actions. See Rule Expressions. |
| Value Action | => expr: the action that follows a complete Rule Expression and computes the value of the rule from its captures. See Actions. |
| variable | A named int, string or bool value declared by a var declaration, bound and read by actions. See Variables. |