TOC Toolkit API - v0.1.0
    Preparing search index...

    toc-toolkit/grammars

    The grammar kernel. It represents every grammar by productions between sentential forms, so one model covers regular, context-free, context-sensitive and unrestricted grammars. It checks grammar data, recognizes production shapes, applies productions, replays derivations and searches noncontracting grammars for shortest derivations. The grammar syntax and procedure packages build on it.

    • Grammar validation. Checks declarations, production ids, left sides and symbol roles, and reports errors and warnings in a fixed order. (checkGrammar, grammarIssues)
    • Shape recognition. Tests whether every production is context-free, noncontracting, or context-sensitive with the isolated start epsilon rule. (asContextFree, asNoncontracting, asContextSensitive)
    • Production application. Rewrites the occurrence of a left side at a position of a sentential form. (applyProduction)
    • Derivation replay. Applies a list of production ids and positions from the start variable and reports the first failing step. (replay)
    • Shortest derivation search. Breadth-first search over sentential forms that keeps forms no longer than the word, which is complete because no production shortens its form. Exhaustion is reported apart from rejection. (derives)
    • Fresh names. Returns a variable name not in use. (freshVariable, constructedVariable, asVariableName)
    • Sentential forms. Sequences of terminals and variables with role-aware equality. (SententialForm, GrammarSymbol, Terminal, Variable, terminal, variable, sameForm)
    • Productions. General productions and the context-free and right-linear shapes. (Production, ContextFreeProduction, RightLinearProduction, ProductionId, VariableName)
    • Checked grammar. A branded grammar with separate property brands for noncontracting and context-sensitive grammars. (Grammar, Noncontracting, ContextSensitive, GrammarKind)
    • Derivation steps. A production id with the position of its occurrence. (DerivationStep)
    • Decoders. Check grammar data that arrives from outside. (grammarDecoder, grammarDataDecoder, symbolDataDecoder, productionDataDecoder, grammarSymbolDecoder, sententialFormDecoder, derivationStepDecoder, variableNameDecoder, productionIdDecoder, grammarIssueDecoder, grammarTargetDecoder)
    • Enumerations. Name the closed sets of strings that the types and the wire data of the package use. (GrammarIssueCode, SymbolKind)