Skip to content

Syntax Reference

Terse reads like English. No braces. No semicolons. Indentation defines structure.


Facts

Declare knowledge about a node.

know dog is animal
know dog has fur
know dog weight 0.87
know dog has legs 4

Relationships

Declare a directed edge between two nodes.

dog chases cat
cat fears dog

Any two-word line where the first word is a known node is a relationship declaration.


Inference Rules

Declare a rule: if a condition is true, derive a new fact.

when has fur then is mammal
when is mammal then has warm blood

Inference

Apply all known rules to a node and derive new facts.

infer dog

Terse walks the inference rules, checks the node's facts, and adds derived facts automatically.


Sequence Learning

Teach Terse a chain of concepts. Builds Markov chain transition probabilities.

learn dog chases cat runs away
learn dog chases cat hides

Prediction

Predict the most likely next concept after a given concept.

predict after chases

Returns the concept with the highest transition probability, with a confidence score.


Generation

Chain predictions into a sequence starting from a concept.

generate from dog steps 3

Follows the most likely path through the Markov chain for N steps.


Functions

Define a reusable block with a parameter.

to classify thing
  infer thing
  return thing

Call it:

classify dog
  • to opens a function definition
  • The next word is the function name
  • The word after is the parameter name
  • Indented lines are the body
  • return returns a value

Each Loop

Iterate over all nodes of a given type.

each creature in animal
  classify creature

Finds all nodes where is == animal and runs the body for each, with creature bound to each node in turn.


While Loop

Repeat while a condition holds.

while running is true
  infer model

Has a 100 iteration safety limit during development.


Comments

// This is a comment

Keywords

know, is, has, when, then, infer, each, in, to, return,
and, or, compress, expand, can, needs, if, while, not,
true, false, weight, node, graph, edge, tensor, query,
onboard, ethics, rule, deny, allow, learn, predict,
generate, after, from, steps

Design Principles

  • Two-word lines are function callsclassify dog calls the classify function with dog as argument
  • Three-word lines are relationshipsdog chases cat declares an edge
  • Indentation defines scope — function bodies are indented, no braces needed
  • Nodes never decay — same principle as NCI. Explicit deprecation only.
  • The compiler absorbs complexity — memory management, type layout, tensor representation are compiler responsibilities, not programmer responsibilities