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

    toc-toolkit/models

    The layer that every kind of model meets before an algorithm sees it. It joins the machine kinds, the grammar kinds and regular expressions into the unions ModelKind, ModelDraft and Model. It checks a draft into a model, runs a model on a word, and prints the text of a source model. The editors and the app use its registry, so they hold no code for a single kind.

    • Draft checking. Enforces draft size limits, then runs the kernel check or the notation parser, then the lints of the kind. (check, issuesOf, machineBoundaryIssues)
    • Model running. Dispatches a word to the engine of the kind. Regular expressions, DFAs and NFAs use NFA simulation, other machines use the breadth-first kernel search, context-free grammars use Earley parsing, context-sensitive grammars use the noncontracting derivation search, and unrestricted grammars use the derivation search of the Turing package. Exhaustion is a status and never a rejection. (runModel)
    • Canonical text. Prints any model, and the source of a source model, in canonical notation. (canonicalText, printSource)
    • Draft keys. Gives a draft a stable key and projects a model back to its draft. (draftKey, draftOf)
    • Model readers. Read the kind and the checked alphabet of a model, and the source text of a draft without parsing it. (kindOf, alphabetOf, draftSourceText)
    • Kind registry dump. Prints the registry as stable text. (dumpKinds)
    • Model unions. The kinds, drafts and checked models of the three families, with tests for each family. (ModelKind, ModelDraft, Model, isMachineModel, isGrammarModel, isRegexModel)
    • Kind registry. One entry for each model kind, with its family, language class, preset, definition fields, lints, trace view and completion tokens. (KINDS, KindRegistry, DefinitionField, MACHINE_NOTATION)
    • Language classes. The classes of the Chomsky hierarchy with their rank by inclusion. (LanguageClass, CLASS_RANK)
    • Draft limits. Caps on the number of states, transitions, symbols and name lengths. (DRAFT_LIMITS)
    • Run results. A status with a trace view and a witness such as a transition path, a parse forest or a derivation. (ModelRun, RunTrace, RunWitness)
    • Decoders and encoder. Check models, drafts and runs that arrive from outside. (modelDecoder, sourceModelDecoder, modelDraftDecoder, sourceDraftDecoder, modelRunDecoder, runTraceDecoder, runWitnessDecoder, modelIssueDecoder, modelOwnIssueDecoder, encodeModel, definitionFieldDecoder, definitionSpecDecoder, draftLimitsDecoder, expressionKindDecoder, languageClassDecoder, modelFamilyDecoder, modelIssueCodeDecoder, modelKindDecoder, runTraceKindDecoder, sourceKindDecoder, witnessKindDecoder)
    • Enumerations. Name the closed sets of strings that the types and the wire data of the package use. (ExpressionKind, ModelFamily, ModelIssueCode, RunTraceKind, WitnessKind)
    • Constants. Fix the limits and tables that the package exports. (MODEL_KINDS)
    • Kind guards. Tell whether a kind is one of the machine presets and whether a model has a source text editor. (isMachineKind, isSourceModel)