Skip to content

Changelog

A. Arda UZAN edited this page Nov 24, 2026 · 1 revision

As of v1.0.0

The wiki is stamped per tag: the first line of every page except Home names the release it describes.

1.0.0

This entry lists what 1.0 changes against 0.5.0. The Language page describes the whole of 1.0.

Files and versions

  • A declaration file opens with #lang typify, which replaces the grammar selector line of 0.5.
  • The package version is the language version. Each release reads one grammar, its own. There is no compatibility table, and the older grammar versions are not read.
  • The meta language's self-declaration, typify.typify, is written from the reader's own table into every release at typify/share/typify.typify, beside bin/, while typify emit Typify prints its JSON grammar (or GBNF with --gbnf). The repository keeps no copy of typify.typify, and no hand-written .typify source file outside the test fixtures under test/.

Classes

  • Classes are checked. A class expression is built from quoted literals ("book"), patterns between slashes in a regular core (/[^=]+/), names of other classes, sequence by juxtaposition, alternation by |, and except over literals. Inside a pattern, \/, \|, \", \\ and \. stand for /, |, ", \ and ., and the escapes \d, \w, \s, \xHH, \uHHHH and \u{H…H} abbreviate ranges. A class is anchored to the whole capture, the exact text the form's literals delimit, untrimmed, and a capture that fails its class is an error with the code E_CLASS. See Classes.
  • No class matches a control character, a format character, a line or paragraph separator, or a space separator other than U+0020: a class's language is its pattern's language intersected with the allowed code points, so a negated range or . never admits a refused code point. A class is legal whatever code points it names, and a class whose language is empty after the intersection carries the note N_CLASS_EMPTY, not an error.
  • Three classes are built in. letter matches one letter of the Unicode letter categories, and a run of letters is letter+. canonical-path matches the root /, with zero components, and every other absolute path whose components are non-empty, over the allowed code points other than U+0020, the space, none of them . or .., with no trailing slash: a path with a space fails the class, so a placeholder of the class can hold no delimiting space, and form : bind : <path> <mode> has no overlap. parent of / is an error. relative-path matches one or more components joined by single slashes, with no leading, trailing or repeated slash and none of them . or .. or holding U+0020, the component rule of canonical-path, so a relative path joined under a scope always yields a canonical path. A scope resolves an argument only at a signature position declared relative-path, or a class that is a bare reference to it, directly or through further bare references, joining it to the first argument of the workdir term of the program the scope names; the resolved value must be a canonical-path.
  • A class is decided by its expression alone. A class without | is no longer read as a description that accepts any nonempty text, and a bare name in an is line that names no class is an error with the code E_CLASS_UNDECLARED; a placeholder whose class is undeclared is E_DECLARATION of kind capture, with the placeholder as written, angle brackets included (<price>), as actual.
  • cap lines bound a body's classes: the control states of a class's pattern automaton, the repetition, the reference depth (0 for a class that references no class) and the length of a capture, which is counted apart from the states. A body may lower the meta body's defaults, never raise them.
  • A declaration is rejected when two of its forms shadow each other (E_FORM_SHADOW), or when adjacent placeholders cannot both capture or a class can hold the literal that follows its placeholder (E_CLASS_OVERLAP).

Terms, counts and examples

  • does gives a term, and term declares each constructor with the classes of its arguments. A program's meaning is the list of its lines' terms, followed by its defaulted terms, printed as JSON. A constructor with no arguments is written without a trailing colon, term : ready and primitive : ready; a trailing colon is E_DECLARATION of kind syntax. See Terms and counts.
  • count states multiplicities: 1, 0..1, 1..* or *, the default. It takes the place of 0.5's once, which is 0..1. A keyed count, count : <constructor> = <multiplicity> by <k>, applies the multiplicity to each distinct tuple of the first k arguments among the constructor's terms of one program, defaulted terms included; the plain form is by 0, the whole program. k is read under the meta class width, as the width of delete <k> is, so by 0 is legal. A constructor may carry one unkeyed and one keyed count: a second of either kind is E_DECLARATION of kind duplicate, with the line as written as actual, by 0 written out being the unkeyed form, and a k greater than the constructor's number of arguments is kind syntax, with the count line whole as actual. A keyed count requires no group to exist, so it fails only by excess within a group. A count failure is E_PROGRAM_COUNT, with the multiplicity as written, a string, as expected, the group's count, an integer, as actual, and its tuple, an array of decoded strings, as key, empty under an unkeyed count. A keyed count gives one diagnostic per failing group, each anchored within its program as a count failure is, and an unkeyed failure's stands beside them, all in position order.
  • restricts!, written below a form in the body and belonging to the nearest form above it, marks a form whose absence fails open. Its constructor must carry an unkeyed count = 1 or 1..*, or a default line under any form of the constructor, or the declaration is rejected with the code E_RESTRICTS; a keyed count never satisfies it on its own.
  • Examples run: each example line is checked against its form and its term is built, library calls included, a template placeholder taking the shortest witness of its class. An example that fails is an error; one whose library call fails carries the library's own code, E_LIBRARY_DOMAIN or E_LIBRARY_PARENT, covering the library call in the form's does line. Only (context ...) and (inherited ...) are not evaluated at an example. Under them, formation is checked whole when the declaration is read: the constructor named exists; the expression's sort is a list under each and a string elsewhere, E_TERM_CLASS of kind sort otherwise; and a constructor whose rules carry an each has its fuel cap, a context outside any each requiring none. Only the values are read when the located program is planned, against its enclosing programs.
  • default replaces absent, and a default : <line> line stands after a form. The reader is closed-world: a missing line is no term. Defaults are activated per constructor: when a program, present or absent, holds no term of a form's constructor by any form, every default line of that constructor's forms is added, in declaration order, after the program's own terms, with an origin of kind default, which names the declaration file and the line of the default line; a present line of the constructor suppresses them all. Activation precedes the count check, so a default satisfies count = 1, and an absent optional program holds only its defaults. A default line's arguments are literal text: a default line whose form's does term uses a template placeholder is E_DECLARATION of kind syntax, while text such as <name> written in a default line is read as literal text against its class (failing with E_EXAMPLE when rejected).

Facts and effects

  • A constructor is a fact or an effect. In a body that declares no primitive, every constructor is a fact and its does builds data. In a body that declares a primitive, every constructor is a primitive, is rewritten by a rule, or is declared fact : <constructor>; any other is rejected with a column. The meta language is bound by the same rule, and declares its kernel primitives external. See Primitives and state.

Primitives and state

  • primitive, writes, cell, reads and ensure declare what a host executes and the state the reader predicts. See Primitives and state.
  • A cell's law is shadow, first, or join over a declared join table. A join cell has exactly one value argument, over a class of literals, and its table has one join line per unordered pair of distinct literals; a literal joined with itself is that literal, by idempotence, and need not be listed: the diagonal is implicit, a listed pair of a literal with itself whose result is its own literal is legal and ignored, and one whose result is another literal is E_JOIN_LAW with expected idempotent and the diagonal's own literal, not the result, as actual. The reader derives the symmetric entry, so the table is commutative and idempotent by construction. The table's domain is the literal class of the value argument of the cell that names it; two cells that name one table must share that class, the later cell line in position order within the declaration file being E_DECLARATION of kind conflict otherwise. A table that fails a law is E_JOIN_LAW, its expected one of complete, once, associative, idempotent and closed, and its actual, decoded, correspondingly the missing pair, the pair of the second listing of a pair listed twice with different results, the triple, the diagonal's own literal, or the literal outside the domain that a pair or a result names; a pair or a triple is its literals separated by one space, an authored pair in authored order, as ro rw for the pair "ro" "rw", and a pair or a triple that nothing authored, the missing pair of complete or the triple of associative, in the order of the value class's literals, or, for a table no cell names, a triple in the order of its literals' first appearance in the table's join lines, each line read left to right, its result included. A table that no cell names is checked for once, associative and idempotent over the literals it lists, and for complete and closed only once a cell names it. E_JOIN_LAW is the table's: it names the table as cell, stands at the second listing of a pair listed twice with different results and at the table's first join line otherwise, and is reported once whether two cells use the table or none; a cell line naming an undeclared table is E_DECLARATION of kind reference. Joins over tuples are not in 1.0.
  • A stacking cell's keys end in paths, and a later put at an ancestor hides a descendant. Its key is a tuple of width one or more whose last component is a path, of class canonical-path or a class the reader can show is a subset of it, and whose earlier components, if any, partition the cell. The earlier components of a partitioned key are all the placeholders of the holding program's file template, in template order, each such component of a put or delete term being a placeholder of that template, and a put with fewer components, or any other value in those places, is E_DECLARATION of kind partition, reported when the declaration is read, on the does or rule line whole whose term supplies the components, with the term as written as actual. A program located by a template writes only partitioned cells, a stacking cell or any other: every put or delete from it carries the template's placeholders as the leading key components, so a language with a file line has no unpartitioned write, and under file : teams/<team>/shares.typify with writes : bind : mounts = put 1 a does or rule line building bind is kind partition at that does or rule line whole (while a writes line whose put width is smaller than the number of template placeholders, such as put 1 under file : teams/<team>/<kind>/shares.typify, is kind partition at that writes line whole); a template without placeholders supplies no component, and its writes are unchanged. Ancestry, masking and visibility are judged only among entries whose earlier components are equal, so one partition's mask never hides another partition's path, and delete k on a partitioned stacking cell, with k the number of its partition components, all key components but the last, clears one partition. On every partitioned cell a delete names at least its partition components: a delete k with k below their number, delete 0 included, is kind partition, reported at the writes line whole, with the line as written as actual. E_KEY_CANONICAL concerns the last component, and covers the cell line whole, the cell being the subject of the defect. A cell that is not stacking may have a key of any width, at least as wide as the template's placeholders when a program located by a template writes it. See Stacking cells.
  • A cell's key width is fixed by its first put writer, resolved in the declaration order of the languages, then in line order, never in tree order; every other put to the cell must have that width, and every delete a width from 0 to it. A root in which a cell has no put writer at all is E_DECLARATION of kind reference at plan, and no width is guessed for delete 0; a declaration file checked alone whose cell has only delete writers passes check with the note N_CELL_WIDTH. A delete of width k removes every entry whose first k key components equal the term's first k arguments, compared as whole components, never by path ancestry, and, on a cell that is not partitioned, delete 0 clears the whole cell, a stacking cell included.
  • Cell names are global across the languages of a root: cells of one name are one cell only when they agree on the class of each key component, the same built-in class in both or a declared class of one name whose expression is identical as written in both bodies, and on their law, stacking, key width and join table, and the state's keys are the bare cell names. A bare reads or guard on a partitioned cell supplies the fact with the key components after the partition: a fact of one argument takes one such component, and a key with more is E_DECLARATION of kind arity on that line, which must then be a parenthesized call. A key width mismatch and a disagreement between cells of one name are E_DECLARATION of kind conflict.
  • ensure attaches a named invariant to the terms of a constructor, whether it is rewritten, a primitive or a fact, and binds its variables <1> to <n> by position to the constructor's arguments. It is evaluated once per term that carries it, against the final predicted state, with the built-in predicates bound, masked, visible, absent, covered and uncovered, which binary conjunction (and P Q) may join, each state predicate naming a cell and then each component of the key, as in (visible mounts <1>). For a stacking cell, (covered <cell> <key> ...) holds when some proper ancestor of the key's last component, in the key's partition, satisfies visible, and (uncovered <cell> <key> ...) is its negation. The state predicates are usable in ensure only: (if ...) takes a fact call or one of the library predicates prefix, suffix and equal, never a state predicate, since the state predicates observe only the final predicted state, whoever wrote it, and a conditional over the state is not in v1. A state predicate inside (if ...), and covered or uncovered on a cell that is not stacking, are E_DECLARATION of kind syntax, on the rule or ensure line whole. A state predicate reads the cell it names and nothing else, so a check about one kind of entry reads a stacking cell that only that kind writes, keyed by the resolved path. Protected paths take two cells, written for instance by a program at the root: protected, a stacking cell of the protected paths, read with (uncovered protected <1>), which refuses a grant below one, and protected-above, each protected path and its proper ancestors, read with (absent protected-above <1>), which refuses a grant at or above one; their writers put a value, as in writes : protect : protected = put 1 "protected" and writes : protect-above : protected-above = put 1 "protected", since a valueless put writes the entry masked and uncovered would then pass every grant. A put with no value writes the entry masked: masked holds at a key when the latest put there has no value, and bound when it has one. A state entry's masked is its own put's flag, true exactly when the put that wrote the entry carried no value and false when it carried one; an entry hidden by a later mask at an ancestor keeps its own masked, since that hiding is visibility, judged by (visible ...) when an invariant is evaluated and serialized nowhere: a state entry has no visibility field. A writes line may give a quoted literal after the width, as in writes : deny-access : denied = put 1 "denied": it is a value appended after the primitive's remaining arguments, admitted as written, and it stands in the state entry, not in the primitive's term. A cell's value is the put's values as written, zero or more, of no fixed arity: the class of each value is the writing primitive's signature at that position, or the literal itself, and only a join cell fixes one value argument, over its table's domain.
  • effect : <primitive> = external declares a primitive with no writes line. plan counts it unmodelled and prints it unchecked. A primitive with neither a writes line nor this declaration is refused with E_DECLARATION of kind effect. effect : <primitive> = state declares a primitive that has its writes and no host action: plan --json lists its terms under recorded, in plan order with their origins, apart from plan, and modelled counts executed terms only. A primitive declared state without a writes line is kind effect too, as is any primitive without a writes line that is not declared external.
  • A check across the lines of one program, a fact beyond the six, and a mount whose path the host supplies are not in v1's model: each is a host precondition, or effect : <primitive> = external, and stands in the consumer's declaration as a note : <constructor> = <text> line, text being a meta class that admits any run of allowed code points, which ? : <word> prints.

Rules and plans

  • rule rewrites a term into a sequence of terms, down to primitives. See Rules and plans.
  • Nine library functions are defined. Eight are over strings: parent, join, split, ancestors and concat, usable on a rule's right side, and the predicates prefix, suffix and equal, usable only in (if ...) and ensure. The ninth, inherited, is also usable on a rule's right side: (inherited <constructor>) is the list of the first arguments of every term of that constructor in the program's enclosing programs, nearest program first and in line order within a program, and the empty list when there is none; a constructor of more than one argument under it, or under (context ...), is E_DECLARATION of kind arity, with the constructor as named as actual, never truncated to its first argument. It reads the terms of the enclosing programs, which the reader has already read, and no file, process or network. A loop over it emits in list order, nearest first, so a shadow cell keeps the farthest program's value and a first cell the nearest, and a consumer that wants the nearer program to win declares the cell first. prefix compares strings and never stands for path containment, which is equal over ancestors, or covered on a stacking cell. parent, split, ancestors and the first argument of join take a canonical-path, the root / included, and refuse any other string with the code E_LIBRARY_DOMAIN; join's second argument is one or more components joined by single slashes, with no leading, trailing or repeated slash, no empty component and none . or .. or holding U+0020, and is refused otherwise; concat, prefix, suffix and equal take any allowed strings; inherited takes a declared constructor, an undeclared one being E_DECLARATION of kind reference, and both lookups take Language.constructor, a bare name being resolved when the declaration is read, against the composition, the set of bodies of the declaration file, in the one-program forms as under a root, accepted when exactly one body declares it and otherwise refused as kind reference, with the name as actual and the declaring bodies in related, by tree, plan, ask and emit as by check, since every command reads the declaration first and reports all its diagnostics; parent of / is an error with the code E_LIBRARY_PARENT, although / is in its domain. There are no other edge cases: outside its domain a call is an error, never a host default. Rules and plans gives each one's signature, result and domain.
  • Eight constructs extend rules and primitives: stage, (context ...), a keyed merge through a join cell and a reset through a delete write, (if ...), a check over constants as an ensure line, guard, scope, and (each ...) under a fuel cap. Each loop, nested loops included, is bounded by its carrying constructor's fuel cap on its own, and iterates a list of ancestors, split or inherited only, as in (each <x> in (inherited deny-exec) <term>); over an empty list it emits nothing, and over a lookup an E_RULE_FUEL carries in related the origin of the first term past the cap. (context <constructor>) is the first element of (inherited <constructor>), and E_CONTEXT when that list is empty; an undeclared constructor named by (context ...) is E_DECLARATION of kind reference, as under inherited. A lookup that crosses a guarded program adds to the reading program's skips the entry {"reason": "guard", "fact": ..., "args": [...], "program": ...}, fact and args being the guarded program's guard fact and its evaluated arguments, and program the guarded program's portable path.
  • typify plan prints the ordered primitive terms of each program, with the predicted state, one list of entries per cell in key order (the decoded key tuples compared component by component, by code point, a proper prefix first, never by their JSON text), its bound, the origin of every executed term, each state entry carrying its own origin (and, on a stacking cell, its sequence), the result of every evaluated ensure (its name, ok and origin), per program and for the root, and the skips, each with its constructor, fact, args, reason (if, read or guard) and origin, except the entry of a lookup that crossed a guarded program, given above, and, over a root, listed in each program's entry and nowhere at the top level, how many primitives are modelled, counting executed terms only, the terms of state primitives under recorded, apart from plan and, over a root, beside it in each program's entry and nowhere at the top level, an array of {"term": [...], "origin": {"kind": ..., "path": ..., "line": ...}} objects in plan order, the top-level origins referring to the executed terms of plan only, a status, failed when a diagnostic of error severity exists and otherwise ok when every primitive is modelled and unchecked when one is not, which text mode prints on its first line, and, with --json, a diagnostics array, empty when nothing is reported. A skip by a false (if ...) carries the suppressed term's constructor as constructor, never the carrying rule's. In text mode a recorded term is printed prefixed by its program's path and the word recorded, and an external term ends with unchecked (when nothing was planned, standard output is empty and only the diagnostics print). A modelled term is an array, its constructor then its arguments, and an external one is the object {"term": [...], "unchecked": true}; an external primitive is not an error, and plan exits 0 unless a diagnostic of error severity exists. Over a root, the plan is one list sorted by stage, stable in tree order and then term order (carried in schedule, alongside inputs), and the predicted state is one fold over that list. c_D bounds every folded event, executed and recorded alike, and the state's size is at most k times the sum of the lengths of plan and recorded. A failing ensure does not replace the report: plan --json prints its arrays whole, ensure holding every evaluated entry, its diagnostics holds one E_ENSURE per false entry and any other diagnostic, its status is failed, and it exits with status 1. A complete expansion can fail only at the fold, with E_FACT_REJECT, or after it, with E_ENSURE, whose fold is complete. On E_FACT_REJECT the fold stops at the rejected read: state is {} and ensure is [], since every invariant is evaluated against the final state after the whole fold, which does not exist; skips holds the skips decided before the rejection, each skipped term out of plan, origins, recorded and modelled; plan and origins hold the expanded plan as a successful plan would print it up to the rejected read, the rejected term itself, and every term after the rejected read as expanded, undecided. recorded and modelled describe the expanded plan, whether or not the fold reached a term: recorded holds the terms of state primitives in plan order, before and after the rejected read, all but those skipped before it, and modelled counts every term of plan, the undecided ones included. Such a plan's status is failed, and it exits with status 1. E_CONTEXT, E_LIBRARY_DOMAIN, E_LIBRARY_PARENT, E_RULE_FUEL and every other diagnostic raised while a plan is expanded or normalized are failures within expansion, since lookups, inherited lists and library calls are evaluated as a rule's right side is rewritten. Such a failure prints the object of a plan where nothing was planned, with plan, origins, recorded and skips empty, state {}, over a root programs [], modelled "0 of 0", status failed and its computed bound, and exits with status 1; the failing term is named by the diagnostic's range and data alone, never by the arrays, and nothing of a partial rewrite is printed. A rule cycle is not a failure within expansion: E_RULE_CYCLE is found when the declaration is read, and a rewrite that runs away ends as E_RULE_FUEL. When nothing was planned, because a declaration has an error, an input cannot be read, or, for plan, the expansion fails, tree prints its object with ok false and plan its object with status failed, their arrays empty, programs included, plan's state {} and modelled "0 of 0", and diagnostics holding the diagnostics. plan's bound is computed from the declaration and the input, and carried as the JSON member bound whenever both were read, text mode printing no bound line, a failed plan included; zeros are never printed in its place, and it is null when the declaration has an error and nothing could be computed.
  • typify plan DECLARATIONS LANGUAGE PROGRAM [--facts FILE] plans a single program, the form for a language that has no file line; when the declaration reads a fact and no --facts is given, it is E_USAGE, with --facts as actual, since there is no root to collect from. The one-program forms of check and plan both take --facts; check never reads a fact, so a --facts given to it is accepted and ignored, and that E_USAGE is plan's alone. In them a language with a file line binds its template placeholders by matching the program's path, as given on the command line, against the template; a path that does not match is E_USAGE, with the path as actual.
  • typify facts ROOT writes the facts file. The facts of v1 are six: the collector's five, exists, directory, symlink, mode and owner, and clean, which the reader derives from the facts file and no collector writes. (clean <path> <name>) holds when <path> belongs to the observed facts root and no entry at depth two or more below <path>, for which directory or symlink holds, has <name> as its last component: the entry <path>/<name> itself, a root's own immediate marker, is not a nested one, a regular file of that name is ignored, and an ancestor marker is declared separately, over ancestors. It is usable wherever a fact call is, in a guard, a reads line or (if ...); no general query over the facts exists. A reads or guard line naming any other fact is E_DECLARATION of kind reference. The collector omits an entry whose path is not a canonical-path, a space (U+0020) in a component included, and writes "omitted": n beside facts, n counting each omitted entry once, the descendants of an omitted directory included, since the traversal is not pruned, and never once per fact, when n is positive, and no omitted member otherwise; the second collector agrees. A fact over an omitted entry is absent, and clean does not see below it. omitted is part of the facts wire: when present it is a positive integer, checked as the rest of the file is, and when absent it is zero. A fact carries a boolean or a text value; list-valued facts are not in 1.0. Canonical is lexical: root and every fact argument are canonical-path strings, and nothing resolves a symbolic link. A relative root or file given on the command line is joined to the current directory as the operating system reports it, never to the PWD environment variable; the reader then normalizes a root lexically, and no symbolic link in the joined path is resolved. Wherever the collector runs (typify facts ROOT, or tree or plan over a root that needs a fact), a root that is not a canonical-path after that normalization is E_USAGE, with the root as supplied as actual (nothing is stripped, and no other root is invented), and a symbolic-link root is E_FILE. A facts file given with --facts that does not follow the facts wire is refused with E_FILE, carrying that file's path; when facts, plan or tree runs the collector, E_FILE carries the path of the root or entry that could not be read. A declaration reads a fact when it holds a guard line, a reads line, or a fact call inside (if ...) in a rule; tree needs facts for the first two only, and plan for all three. A plan that needs a fact reads the facts file with --facts FILE; without --facts, a plan over a root that needs a fact runs the collector itself and reports the file's hash in the facts member of plan --json. The hash is sha256: followed by sixty-four lowercase hex digits, or none. Over a root without --facts, a plan that needs a fact runs the collector, and facts is the digest of the collector's output exactly as typify facts ROOT writes it. The digest names the bytes read: whenever the declaration reads a fact and a facts document was read and accepted, facts carries its sha256: digest in every outcome, status failed included, and facts is none only when the declaration reads no fact, or when no facts document was read and accepted: a facts file that cannot be read, or that does not follow the facts wire, is E_FILE, and its hash is none even when its bytes were read. A tree that needs a fact also takes --facts FILE or runs the collector. A tree or plan that needs no fact accepts a --facts FILE and ignores it, without opening the file, so nothing in it is validated.

Questions

  • Every language accepts ? : <word>. The answer is the word's declaring lines, each under the reserved ?, printed as Typify lines and as JSON. An answer's forms are those whose verb is the asked word and those whose does line builds the constructor the word names, each once, in declaration order. A form line and its does line are a pair, and the pairs come first, in declaration order. Its lines come in this order: the first form line, the language's file line, the first does line and the form's restricts! line when it has one, then each further form line with its does line and its restricts! line when it has one; then, once, the term or primitive line, the is lines of the forms' and the template's placeholders that the does lines name, each once, in the order of their first naming, the constructor's own lines, every line whose first name after the introducer is the constructor (writes, reads, guard, effect, stage, scope, fuel and, for a fact constructor, fact), in declaration order, whatever its kind, the rule lines whose left side is the constructor, its ensure lines, the examples, the count lines (the unkeyed count line, or count : <constructor> = * when none is declared, then the keyed one when one exists), the missing line, which states the case in one word, ? : missing : default, ? : missing : refused or ? : missing : empty, the default lines, which state the defaults themselves, and the constructor's note lines last. An answer with more than one constructor prints the lines from the term or primitive line through the ensure lines, each constructor with the is lines of the placeholders that its own forms' does lines name, each once within its group, in the order of their first naming, and later the count, missing and default lines, for each constructor in turn; its example lines print once, in their place, in form order, and its note lines last, for each constructor in turn. A class is answered by its is line alone, and a cell by its cell line and its table's join lines, neither with a file line; the three built-in classes are declared by no body, but a form's verb may be spelled like one, and that verb is a declared word of its body like any other verb; each of the three spellings is undeclared in a language none of whose forms has it as its verb. A spelling declared as a verb or a constructor and also as a class or a cell is answered by the union of its answers, in that order, and no line is printed twice. See Questions.
  • A word that nothing declares is answered undeclared, then by near lines and nothing more: the verbs and constructors of the asked language at the least optimal string alignment distance within a bound of one or two edits, every tie named, or, when none is within the bound, those that share a hyphen part with the word. An undeclared word exits with status 0. The JSON object keeps an accepts member, always empty, and no accepts line prints. No diagnostic offers a fix: every diagnostic carries fix null.
  • ask's diagnostics carries what reading the declaration reports, notes included. A declaration with an error, or an unreadable file, gets no answer: under --json ask prints {"ok": false, "diagnostics": [...]}, with no answer fields, and in text mode the diagnostics' projections and no answer line.
  • An asked word that the language does not declare is checked against the verb class before it is echoed, and one that fails it is E_USAGE, exit status 2. ask reads the asked language alone.
  • typify ask DECLARATIONS Typify WORD answers from the meta body, which declares the question itself: the class verb, the form ? : <verb>, and the external primitive question that its does line builds. Typify is reserved as a body's name, and ? as a verb: a body named Typify, or a form with the verb ?, is E_DECLARATION of kind duplicate, except in the reader's own meta source, byte for byte, which is the meta body itself.
  • check takes no term from a question line and passes over it; a host that answers a program's question lines runs ask for each word. A question line is accepted in a declaration file too, inside or outside a body: a well-spelled one declares nothing and is not reported, and one whose word fails the verb class is E_QUESTION.

Trees

  • typify tree walks a root, reads every program that the declarations locate, and reports each program as present, defaulted, absent-empty, missing or guarded. With --json it prints one object, {"ok": true | false, "programs": [...], "diagnostics": [...], "facts": ..., "inputs": {...}}, the programs in tree order and every diagnostic, notes included; no command prints a bare array. See Trees.
  • The placeholders of a language's file template are bound in every program the template locates: a does line, a rule's right side or an ensure line of that language may use <name> of a template placeholder as a capture of that placeholder's class, so a value the tree supplies, such as a directory's name, reaches a primitive as an ordinary argument; a writes line, which is positional, takes none. A form placeholder or a rule variable of the same name is E_DECLARATION of kind duplicate, with the placeholder as written, angle brackets included, as actual, and a language without a file line has no template placeholders. A body holds one file line, a second being kind duplicate, and a placeholder name repeated within one template is kind duplicate too. A capture reads the placeholders of the program that holds the term, whatever the term's scope, which chooses only the workdir that joins a relative-path argument, and a template placeholder's class is checked against the receiving signature when the declaration is read. See Template placeholders in terms.
  • A sees line names one body, and several bodies take several sees lines: sees : Config Notes is one invalid name, refused with E_CLASS on the sees line, its class being the meta class name. See Naming another language.

Emission

  • typify emit prints a language's grammar as JSON, under --json or by default, and also as GBNF with --gbnf. It prints the grammar alone, a document and not a report: never a diagnostics key and never a note, which check reports. On a failed declaration it prints {"ok": false, "diagnostics": [...]} under --json, and the text projection otherwise, and exits with status 1, as check does; --gbnf with --json is E_USAGE, with --gbnf as actual. The JSON grammar holds the language's name and version, a top-level comment string (always present: the body's comment prefix, or empty when comments are disabled), the effective caps, every class the language reaches as a node tree under its qualified name, and the forms. See Emission.

Diagnostics and the command line

  • A diagnostic is one JSON document with a stable code. The codes form a registry of thirty-one, twenty-nine errors and two notes, N_CLASS_EMPTY and N_CELL_WIDTH, and the registry binds from the first tag: each release diffs it against the previous release commit pinned in the release workflow, and a removed or renamed code fails the release. A note never changes the exit status. A diagnostic's nine fields are code, severity, file, range, message, related, fix, data and fingerprints; a range has a start and an exclusive end, each a one-based line, a one-based column counted in code points and a zero-based byte offset. The document follows SARIF's structure, and the text form, SARIF (--sarif), LSP (--lsp) and GitHub annotations (--github-annotations) are projections of it. A diagnostic's file, and a related entry's, is the path as given for a file named on the command line, and the root-relative portable path for a program the tree located. Paths use / on every platform. E_USAGE carries file "", range null and the offending token as actual. E_REQUIRED carries range null and, as file, the declaring file, the declaration file whose declaration carries the required! line, by its path as given on the command line; the missing program's path, or, for a required! template with a placeholder that locates nothing, the template, is data.path alone and appears in no other field. A key in a diagnostic's data, under E_ENSURE, E_FACT_REJECT, E_PROGRAM_COUNT and E_CONTEXT, is an array of decoded string components in key order, the shape of a state entry's key: a width-one key is a one-element array and an empty key the empty array [], never a bare string. Under E_CONTEXT it is [] for a (context <constructor>) with no enclosing program's term of that constructor. For a relative-path argument with no workdir term in scope, it is the full tuple of the key the term writes, one decoded string per component with that argument as written among them, never split at its slashes, only when the failing argument is one of that key's components; whenever it is not, as for an argument in a value position of a writing primitive, an argument of a term that writes no cell, or any other relative-path position, it is the one-element array holding the failing argument as written, and no cell key is carried. A cell key is never widened for a diagnostic. No evaluation is run to report the failure: a key component not yet evaluated when E_CONTEXT is raised, such as a library call or a lookup to the right of the failing argument, stands as written, so the tuple keeps the cell's width, while a component already evaluated carries its decoded string. A usage error, an unknown command included, prints {"ok": false, "diagnostics": [...]} when --json is among the arguments, and the text projection otherwise; its exit status is 2. See Diagnostics.
  • The public corpus, test/corpus/, compares a case's stdout_json, its diagnostics and its exit status, which Command line defines, and, for a --gbnf invocation, its gbnf_assertions, an object {"required_nonterminals": [...], "accepts_lines": [...], "rejects_lines": [...]} whose required_nonterminals holds the root alone: the root rule's presence, and the membership of accepts_lines and rejects_lines in the language the GBNF text recognizes (see Emission). Any other field of a case's expected.json, its aliases and LSP or SARIF projections included, is its author's note and is not compared. A diagnostic is compared by its code, file, range, and of data only the fields the registry lists for the code, never by its severity, message, fix or related. See Test your own host.
  • The reader reports every error it can find, ordered by file, line and column and, within one position, in the order of detection. A declaration is read whole, with all its errors reported, and a program is read only when its declaration has no diagnostic of error severity: check of a program under a failed declaration reports the declaration's diagnostics and exits with status 1 without reading the program. Only the normalization of one term stops at that term's first failure. After a malformed line the reader recovers, as if the line were well formed where it has exactly one well-formed reading and as if it were absent otherwise, and reports no diagnostic that only the recovery would cause. Each cycle of classes or of rules is reported once, at its earliest declaring line.
  • The commands are check, tree, plan, facts, ask and emit. check, tree, plan, ask and emit take --json. With --json, check, tree and plan each print their own object in every outcome, and the object carries a diagnostics array, empty when nothing is reported; ask prints its answer object, whose diagnostics carries what reading the declaration reports, notes included, or, on a failed declaration, an unreadable file or a word that fails the verb class, {"ok": false, "diagnostics": [...]} with no answer fields; emit prints the grammar alone. See Command line.
  • Without --bounds, typify check in text mode prints diagnostics only, and nothing when there is no diagnostic; a note is printed even when the exit status is 0. Its meaning is printed with --json.
  • typify check DECLARATIONS --bounds reports the derived work bounds of the emptiness and overlap checks, as text or with --json, separately from the normal check response and from the grammar. In text mode the report is one entry per line; with --json it is one object with the members ok, bounds and diagnostics, bounds being an object that holds every declared cap, keyed Language.cap even for one body, defaulted effective caps included, each constructor's fuel cap, keyed Language.constructor.fuel, and each host guard by its own name, each with {"limit": n}, and, when any body has rules, c and k, the rule bound of check DECLARATIONS LANGUAGE PROGRAM --json, as plain integers, the maxima over the composition. The bounds depend on the host: the corpus never compares them, and the report claims neither CPU steps nor a representation another host must copy.

Delivery

  • The reader is written in Racket and replaces the TypeScript reader. The release script pins Racket 9.3 by the installer's hash, and contributors install Racket 9.3 (see Contributing). The reader ships as platform archives unpacking to typify/ for Linux x86_64, Linux aarch64, macOS aarch64 and Windows x86_64, and running it needs no Racket. See Install.
  • Each release archive carries typify/MANIFEST.txt, one line for each file in the archive except the manifest itself, with its sha256, its mode (0755 or 0644) and its path from the archive root. The archive hashes and the manifest hashes are subjects of the release's build-provenance attestation and are published in its notes.
  • The programs in the 1.0 archives carry no publisher's code signature, and the macOS program is not notarized. The tags of 1.0.x are unsigned.
  • No solver ships.

Deferred to 1.1

  • uses imports across files, derived! program files, conditional rules, term-sorted arguments (a user term nested inside another), cross-program name resolution for sees, and, for questions, the accepts lines and the fixes of diagnostics (see Questions).

0.5.0

0.5.0 is the TypeScript reader, tagged v0.5.0 at commit 3d284e8, frozen as an oracle.

Clone this wiki locally