Repository navigation
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.
This entry lists what 1.0 changes against 0.5.0. The Language page describes the whole of 1.0.
- 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 attypify/share/typify.typify, besidebin/, whiletypify emit Typifyprints its JSON grammar (or GBNF with--gbnf). The repository keeps no copy oftypify.typify, and no hand-written.typifysource file outside the test fixtures undertest/.
- 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|, andexceptover literals. Inside a pattern,\/,\|,\",\\and\.stand for/,|,",\and., and the escapes\d,\w,\s,\xHH,\uHHHHand\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 codeE_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 noteN_CLASS_EMPTY, not an error. - Three classes are built in.
lettermatches one letter of the Unicode letter categories, and a run of letters isletter+.canonical-pathmatches 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, andform : bind : <path> <mode>has no overlap.parentof/is an error.relative-pathmatches 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 ofcanonical-path, so a relative path joined under ascopealways yields a canonical path. Ascoperesolves an argument only at a signature position declaredrelative-path, or a class that is a bare reference to it, directly or through further bare references, joining it to the first argument of theworkdirterm of the program the scope names; the resolved value must be acanonical-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 anisline that names no class is an error with the codeE_CLASS_UNDECLARED; a placeholder whose class is undeclared isE_DECLARATIONof kindcapture, with the placeholder as written, angle brackets included (<price>), asactual. -
caplines 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).
-
doesgives a term, andtermdeclares 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 : readyandprimitive : ready; a trailing colon isE_DECLARATIONof kindsyntax. See Terms and counts. -
countstates multiplicities:1,0..1,1..*or*, the default. It takes the place of 0.5'sonce, which is0..1. A keyed count,count : <constructor> = <multiplicity> by <k>, applies the multiplicity to each distinct tuple of the firstkarguments among the constructor's terms of one program, defaulted terms included; the plain form isby 0, the whole program.kis read under the meta classwidth, as the width ofdelete <k>is, soby 0is legal. A constructor may carry one unkeyed and one keyedcount: a second of either kind isE_DECLARATIONof kindduplicate, with the line as written asactual,by 0written out being the unkeyed form, and akgreater than the constructor's number of arguments is kindsyntax, with thecountline whole asactual. A keyed count requires no group to exist, so it fails only by excess within a group. A count failure isE_PROGRAM_COUNT, with the multiplicity as written, a string, asexpected, the group's count, an integer, asactual, and its tuple, an array of decoded strings, askey, 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 unkeyedcount = 1or1..*, or adefaultline under any form of the constructor, or the declaration is rejected with the codeE_RESTRICTS; a keyed count never satisfies it on its own. - Examples run: each
exampleline 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_DOMAINorE_LIBRARY_PARENT, covering the library call in the form'sdoesline. 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 undereachand a string elsewhere,E_TERM_CLASSof kindsortotherwise; and a constructor whose rules carry aneachhas its fuel cap, acontextoutside anyeachrequiring none. Only the values are read when the located program is planned, against its enclosing programs. -
defaultreplacesabsent, and adefault : <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, everydefaultline of that constructor's forms is added, in declaration order, after the program's own terms, with an origin of kinddefault, which names the declaration file and the line of thedefaultline; a present line of the constructor suppresses them all. Activation precedes thecountcheck, so a default satisfiescount = 1, and an absent optional program holds only its defaults. Adefaultline's arguments are literal text: adefaultline whose form'sdoesterm uses a template placeholder isE_DECLARATIONof kindsyntax, while text such as<name>written in adefaultline is read as literal text against its class (failing withE_EXAMPLEwhen rejected).
- A constructor is a fact or an effect. In a body that declares no primitive, every constructor is a fact and its
doesbuilds data. In a body that declares a primitive, every constructor is a primitive, is rewritten by a rule, or is declaredfact : <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.
-
primitive,writes,cell,readsandensuredeclare what a host executes and the state the reader predicts. See Primitives and state. - A cell's law is
shadow,first, orjoinover a declared join table. Ajoincell has exactly one value argument, over a class of literals, and its table has onejoinline 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 isE_JOIN_LAWwithexpectedidempotentand the diagonal's own literal, not the result, asactual. 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 latercellline in position order within the declaration file beingE_DECLARATIONof kindconflictotherwise. A table that fails a law isE_JOIN_LAW, itsexpectedone ofcomplete,once,associative,idempotentandclosed, and itsactual, 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, asro rwfor the pair"ro" "rw", and a pair or a triple that nothing authored, the missing pair ofcompleteor the triple ofassociative, 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'sjoinlines, each line read left to right, its result included. A table that no cell names is checked foronce,associativeandidempotentover the literals it lists, and forcompleteandclosedonly once a cell names it.E_JOIN_LAWis the table's: it names the table ascell, stands at the second listing of a pair listed twice with different results and at the table's firstjoinline otherwise, and is reported once whether two cells use the table or none; acellline naming an undeclared table isE_DECLARATIONof kindreference. Joins over tuples are not in 1.0. - A
stackingcell'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 classcanonical-pathor 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'sfiletemplate, in template order, each such component of aputordeleteterm being a placeholder of that template, and a put with fewer components, or any other value in those places, isE_DECLARATIONof kindpartition, reported when the declaration is read, on thedoesorruleline whole whose term supplies the components, with the term as written asactual. A program located by a template writes only partitioned cells, a stacking cell or any other: everyputordeletefrom it carries the template's placeholders as the leading key components, so a language with afileline has no unpartitioned write, and underfile : teams/<team>/shares.typifywithwrites : bind : mounts = put 1adoesorruleline buildingbindis kindpartitionat thatdoesorruleline whole (while awritesline whoseputwidth is smaller than the number of template placeholders, such asput 1underfile : teams/<team>/<kind>/shares.typify, is kindpartitionat thatwritesline 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, anddelete kon a partitioned stacking cell, withkthe number of its partition components, all key components but the last, clears one partition. On every partitioned cell adeletenames at least its partition components: adelete kwithkbelow their number,delete 0included, is kindpartition, reported at thewritesline whole, with the line as written asactual.E_KEY_CANONICALconcerns the last component, and covers thecellline 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_DECLARATIONof kindreferenceatplan, and no width is guessed fordelete 0; a declaration file checked alone whose cell has only delete writers passescheckwith the noteN_CELL_WIDTH. A delete of widthkremoves every entry whose firstkkey components equal the term's firstkarguments, compared as whole components, never by path ancestry, and, on a cell that is not partitioned,delete 0clears 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
readsorguardon 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 isE_DECLARATIONof kindarityon that line, which must then be a parenthesized call. A key width mismatch and a disagreement between cells of one name areE_DECLARATIONof kindconflict. -
ensureattaches 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 predicatesbound,masked,visible,absent,coveredanduncovered, 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, satisfiesvisible, and(uncovered <cell> <key> ...)is its negation. The state predicates are usable inensureonly:(if ...)takes a fact call or one of the library predicatesprefix,suffixandequal, 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 ...), andcoveredoruncoveredon a cell that is not stacking, areE_DECLARATIONof kindsyntax, on theruleorensureline 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, andprotected-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 inwrites : protect : protected = put 1 "protected"andwrites : protect-above : protected-above = put 1 "protected", since a valueless put writes the entrymaskedanduncoveredwould then pass every grant. A put with no value writes the entrymasked:maskedholds at a key when the latest put there has no value, andboundwhen it has one. A state entry'smaskedis its own put's flag,trueexactly when the put that wrote the entry carried no value andfalsewhen it carried one; an entry hidden by a later mask at an ancestor keeps its ownmasked, since that hiding is visibility, judged by(visible ...)when an invariant is evaluated and serialized nowhere: a state entry has no visibility field. Awritesline may give a quoted literal after the width, as inwrites : 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 ajoincell fixes one value argument, over its table's domain. -
effect : <primitive> = externaldeclares a primitive with nowritesline.plancounts it unmodelled and prints itunchecked. A primitive with neither awritesline nor this declaration is refused withE_DECLARATIONof kindeffect.effect : <primitive> = statedeclares a primitive that has itswritesand no host action:plan --jsonlists its terms underrecorded, in plan order with their origins, apart fromplan, andmodelledcounts executed terms only. A primitive declaredstatewithout awritesline is kindeffecttoo, as is any primitive without awritesline that is not declaredexternal. - 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 anote : <constructor> = <text>line,textbeing a meta class that admits any run of allowed code points, which? : <word>prints.
-
rulerewrites 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,ancestorsandconcat, usable on a rule's right side, and the predicatesprefix,suffixandequal, usable only in(if ...)andensure. 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 ...), isE_DECLARATIONof kindarity, with the constructor as named asactual, 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 ashadowcell keeps the farthest program's value and afirstcell the nearest, and a consumer that wants the nearer program to win declares the cellfirst.prefixcompares strings and never stands for path containment, which isequaloverancestors, orcoveredon a stacking cell.parent,split,ancestorsand the first argument ofjointake acanonical-path, the root/included, and refuse any other string with the codeE_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,suffixandequaltake any allowed strings;inheritedtakes a declared constructor, an undeclared one beingE_DECLARATIONof kindreference, and both lookups takeLanguage.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 kindreference, with the name asactualand the declaring bodies inrelated, bytree,plan,askandemitas bycheck, since every command reads the declaration first and reports all its diagnostics;parentof/is an error with the codeE_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 ajoincell and a reset through adeletewrite,(if ...), a check over constants as anensureline,guard,scope, and(each ...)under afuelcap. Each loop, nested loops included, is bounded by its carrying constructor's fuel cap on its own, and iterates a list ofancestors,splitorinheritedonly, as in(each <x> in (inherited deny-exec) <term>); over an empty list it emits nothing, and over a lookup anE_RULE_FUELcarries inrelatedthe origin of the first term past the cap.(context <constructor>)is the first element of(inherited <constructor>), andE_CONTEXTwhen that list is empty; an undeclared constructor named by(context ...)isE_DECLARATIONof kindreference, as underinherited. A lookup that crosses a guarded program adds to the reading program'sskipsthe entry{"reason": "guard", "fact": ..., "args": [...], "program": ...},factandargsbeing the guarded program's guard fact and its evaluated arguments, andprogramthe guarded program's portable path. -
typify planprints 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 ownorigin(and, on astackingcell, itssequence), the result of every evaluatedensure(its name,okand origin), per program and for the root, and the skips, each with its constructor, fact,args, reason (if,readorguard) 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 underrecorded, apart fromplanand, 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-leveloriginsreferring to the executed terms ofplanonly, astatus,failedwhen a diagnostic of error severity exists and otherwiseokwhen every primitive is modelled anduncheckedwhen one is not, which text mode prints on its first line, and, with--json, adiagnosticsarray, empty when nothing is reported. A skip by a false(if ...)carries the suppressed term's constructor asconstructor, never the carrying rule's. In text mode a recorded term is printed prefixed by its program's path and the wordrecorded, and an external term ends withunchecked(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, andplanexits 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 inschedule, alongsideinputs), and the predicted state is one fold over that list.c_Dbounds every folded event, executed and recorded alike, and the state's size is at mostktimes the sum of the lengths ofplanandrecorded. A failingensuredoes not replace the report:plan --jsonprints its arrays whole,ensureholding every evaluated entry, itsdiagnosticsholds oneE_ENSUREper false entry and any other diagnostic, itsstatusisfailed, and it exits with status 1. A complete expansion can fail only at the fold, withE_FACT_REJECT, or after it, withE_ENSURE, whose fold is complete. OnE_FACT_REJECTthe fold stops at the rejected read:stateis{}andensureis[], since every invariant is evaluated against the final state after the whole fold, which does not exist;skipsholds the skips decided before the rejection, each skipped term out ofplan,origins,recordedandmodelled;planandoriginshold 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.recordedandmodelleddescribe the expanded plan, whether or not the fold reached a term:recordedholds the terms of state primitives in plan order, before and after the rejected read, all but those skipped before it, andmodelledcounts every term ofplan, the undecided ones included. Such a plan'sstatusisfailed, and it exits with status 1.E_CONTEXT,E_LIBRARY_DOMAIN,E_LIBRARY_PARENT,E_RULE_FUELand every other diagnostic raised while a plan is expanded or normalized are failures within expansion, since lookups,inheritedlists 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, withplan,origins,recordedandskipsempty,state{}, over a rootprograms[],modelled"0 of 0",statusfailedand its computedbound, 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_CYCLEis found when the declaration is read, and a rewrite that runs away ends asE_RULE_FUEL. When nothing was planned, because a declaration has an error, an input cannot be read, or, forplan, the expansion fails,treeprints its object withokfalseandplanits object withstatusfailed, their arrays empty,programsincluded,plan'sstate{}andmodelled"0 of 0", anddiagnosticsholding the diagnostics.plan'sboundis computed from the declaration and the input, and carried as the JSON memberboundwhenever both were read, text mode printing no bound line, a failed plan included; zeros are never printed in its place, and it isnullwhen 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 nofileline; when the declaration reads a fact and no--factsis given, it isE_USAGE, with--factsasactual, since there is no root to collect from. The one-program forms ofcheckandplanboth take--facts;checknever reads a fact, so a--factsgiven to it is accepted and ignored, and thatE_USAGEisplan's alone. In them a language with afileline 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 isE_USAGE, with the path asactual. -
typify facts ROOTwrites the facts file. The facts of v1 are six: the collector's five,exists,directory,symlink,modeandowner, andclean, 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 whichdirectoryorsymlinkholds, 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, overancestors. It is usable wherever a fact call is, in aguard, areadsline or(if ...); no general query over the facts exists. Areadsorguardline naming any other fact isE_DECLARATIONof kindreference. The collector omits an entry whose path is not acanonical-path, a space (U+0020) in a component included, and writes"omitted": nbesidefacts,ncounting each omitted entry once, the descendants of an omitted directory included, since the traversal is not pruned, and never once per fact, whennis positive, and noomittedmember otherwise; the second collector agrees. A fact over an omitted entry is absent, andcleandoes not see below it.omittedis 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:rootand every fact argument arecanonical-pathstrings, 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 thePWDenvironment 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, ortreeorplanover a root that needs a fact), a root that is not acanonical-pathafter that normalization isE_USAGE, with the root as supplied asactual(nothing is stripped, and no other root is invented), and a symbolic-link root isE_FILE. A facts file given with--factsthat does not follow the facts wire is refused withE_FILE, carrying that file's path; whenfacts,planortreeruns the collector,E_FILEcarries the path of the root or entry that could not be read. A declaration reads a fact when it holds aguardline, areadsline, or a fact call inside(if ...)in a rule;treeneeds facts for the first two only, andplanfor all three. Aplanthat needs a fact reads the facts file with--facts FILE; without--facts, aplanover a root that needs a fact runs the collector itself and reports the file's hash in thefactsmember ofplan --json. The hash issha256:followed by sixty-four lowercase hex digits, ornone. Over a root without--facts, aplanthat needs a fact runs the collector, andfactsis the digest of the collector's output exactly astypify facts ROOTwrites it. The digest names the bytes read: whenever the declaration reads a fact and a facts document was read and accepted,factscarries itssha256:digest in every outcome,statusfailedincluded, andfactsisnoneonly 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, isE_FILE, and its hash isnoneeven when its bytes were read. Atreethat needs a fact also takes--facts FILEor runs the collector. Atreeorplanthat needs no fact accepts a--facts FILEand ignores it, without opening the file, so nothing in it is validated.
- 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 whosedoesline builds the constructor the word names, each once, in declaration order. A form line and itsdoesline are a pair, and the pairs come first, in declaration order. Its lines come in this order: the first form line, the language'sfileline, the firstdoesline and the form'srestricts!line when it has one, then each further form line with itsdoesline and itsrestricts!line when it has one; then, once, thetermorprimitiveline, theislines of the forms' and the template's placeholders that thedoeslines 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,fueland, for a fact constructor,fact), in declaration order, whatever its kind, therulelines whose left side is the constructor, itsensurelines, the examples, the count lines (the unkeyedcountline, orcount : <constructor> = *when none is declared, then the keyed one when one exists), themissingline, which states the case in one word,? : missing : default,? : missing : refusedor? : missing : empty, thedefaultlines, which state the defaults themselves, and the constructor'snotelines last. An answer with more than one constructor prints the lines from thetermorprimitiveline through theensurelines, each constructor with theislines of the placeholders that its own forms'doeslines name, each once within its group, in the order of their first naming, and later thecount,missinganddefaultlines, for each constructor in turn; itsexamplelines print once, in their place, in form order, and itsnotelines last, for each constructor in turn. A class is answered by itsisline alone, and a cell by itscellline and its table'sjoinlines, neither with afileline; 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 isundeclaredin 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 bynearlines 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 anacceptsmember, always empty, and noacceptsline prints. No diagnostic offers a fix: every diagnostic carriesfixnull. -
ask'sdiagnosticscarries what reading the declaration reports, notes included. A declaration with an error, or an unreadable file, gets no answer: under--jsonaskprints{"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.askreads the asked language alone. -
typify ask DECLARATIONS Typify WORDanswers from the meta body, which declares the question itself: the classverb, the form? : <verb>, and the external primitivequestionthat itsdoesline builds.Typifyis reserved as a body's name, and?as a verb: a body namedTypify, or a form with the verb?, isE_DECLARATIONof kindduplicate, except in the reader's own meta source, byte for byte, which is the meta body itself. -
checktakes no term from a question line and passes over it; a host that answers a program's question lines runsaskfor 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 isE_QUESTION.
-
typify treewalks a root, reads every program that the declarations locate, and reports each program aspresent,defaulted,absent-empty,missingorguarded. With--jsonit 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
filetemplate are bound in every program the template locates: adoesline, a rule's right side or anensureline 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; awritesline, which is positional, takes none. A form placeholder or a rule variable of the same name isE_DECLARATIONof kindduplicate, with the placeholder as written, angle brackets included, asactual, and a language without afileline has no template placeholders. A body holds onefileline, a second being kindduplicate, and a placeholder name repeated within one template is kindduplicatetoo. A capture reads the placeholders of the program that holds the term, whatever the term'sscope, which chooses only theworkdirthat joins arelative-pathargument, and a template placeholder's class is checked against the receiving signature when the declaration is read. See Template placeholders in terms. - A
seesline names one body, and several bodies take severalseeslines:sees : Config Notesis one invalid name, refused withE_CLASSon theseesline, itsclassbeing the meta classname. See Naming another language.
-
typify emitprints a language's grammar as JSON, under--jsonor by default, and also as GBNF with--gbnf. It prints the grammar alone, a document and not a report: never adiagnosticskey and never a note, whichcheckreports. On a failed declaration it prints{"ok": false, "diagnostics": [...]}under--json, and the text projection otherwise, and exits with status 1, ascheckdoes;--gbnfwith--jsonisE_USAGE, with--gbnfasactual. The JSON grammar holds the language's name and version, a top-levelcommentstring (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.
- 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_EMPTYandN_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 arecode,severity,file,range,message,related,fix,dataandfingerprints; arangehas 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'sfile, and arelatedentry'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_USAGEcarriesfile"",rangenulland the offending token asactual.E_REQUIREDcarriesrangenulland, asfile, the declaring file, the declaration file whose declaration carries therequired!line, by its path as given on the command line; the missing program's path, or, for arequired!template with a placeholder that locates nothing, the template, isdata.pathalone and appears in no other field. Akeyin a diagnostic'sdata, underE_ENSURE,E_FACT_REJECT,E_PROGRAM_COUNTandE_CONTEXT, is an array of decoded string components in key order, the shape of a state entry'skey: a width-one key is a one-element array and an empty key the empty array[], never a bare string. UnderE_CONTEXTit is[]for a(context <constructor>)with no enclosing program's term of that constructor. For arelative-pathargument with noworkdirterm 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 otherrelative-pathposition, 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 whenE_CONTEXTis 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--jsonis among the arguments, and the text projection otherwise; its exit status is 2. See Diagnostics. - The public corpus,
test/corpus/, compares a case'sstdout_json, itsdiagnosticsand its exit status, which Command line defines, and, for a--gbnfinvocation, itsgbnf_assertions, an object{"required_nonterminals": [...], "accepts_lines": [...], "rejects_lines": [...]}whoserequired_nonterminalsholds the root alone: the root rule's presence, and the membership ofaccepts_linesandrejects_linesin the language the GBNF text recognizes (see Emission). Any other field of a case'sexpected.json, its aliases and LSP or SARIF projections included, is its author's note and is not compared. A diagnostic is compared by itscode,file,range, and ofdataonly the fields the registry lists for the code, never by itsseverity,message,fixorrelated. 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:
checkof 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,askandemit.check,tree,plan,askandemittake--json. With--json,check,treeandplaneach print their own object in every outcome, and the object carries adiagnosticsarray, empty when nothing is reported;askprints its answer object, whosediagnosticscarries 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;emitprints the grammar alone. See Command line. - Without
--bounds,typify checkin 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 --boundsreports the derived work bounds of the emptiness and overlap checks, as text or with--json, separately from the normalcheckresponse and from the grammar. In text mode the report is one entry per line; with--jsonit is one object with the membersok,boundsanddiagnostics,boundsbeing an object that holds every declared cap, keyedLanguage.capeven for one body, defaulted effective caps included, each constructor's fuel cap, keyedLanguage.constructor.fuel, and each host guard by its own name, each with{"limit": n}, and, when any body has rules,candk, the rule bound ofcheck 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.
- 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 (0755or0644) 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.
-
usesimports across files,derived!program files, conditional rules, term-sorted arguments (a user term nested inside another), cross-program name resolution forsees, and, for questions, theacceptslines and the fixes of diagnostics (see Questions).
0.5.0 is the TypeScript reader, tagged v0.5.0 at commit 3d284e8, frozen as an oracle.