• v0.1.0 53e0b04516

    tklips v0.1.0 Stable

    michael released this 2026-10-20 07:32:46 +00:00 | 16 commits to master since this release

    First release of tklips, a CLIPS-inspired rule language, as a single statically linked binary for Linux x86_64. Run a program with ./tklips < program, or start the interactive shell with ./tklips (or ./tklips -i on piped input).

    Language

    • S-expression reader with texts, numbers, lists and objects; results are echoed in a canonical form.
    • Comments: # to the end of the line, and (# ...) forms.
    • Function calls with positional and named arguments ((.name value)), including names and positions taken from variables ((.&var value)).
    • Variables with set, get and &name. Scopes are globals, function bodies and rules.
    • User functions with func and lambda: default arguments, rest parameters (*rest) and spreads (*var). Functions are values, usable with for-each.
    • Control flow: if, while, block, and, or, not, equality and numeric comparisons. Every non-empty text is true, and truth results are 1 and 0.
    • Arithmetic with + - * / % on integers and floats, with errors on division by zero and overflow.
    • Objects: obj, lookup, put, delete, push, pop, insert, remove, len, attrs.
    • Output and text: print, join.
    • Values are shared with copy-on-write; mem counts allocated and live values.

    Facts

    • A fact store: each fact is a relation and an object body, with an implicit .id.
    • fact-add (optionally with a key, to add only when nothing matches), fact-set (an upsert by id or pattern), fact-update, fact-get, fact-del, fact-del-all.
    • Queries with fact-find, fact-match and their -read variants. Patterns match literals, capture slots with &name, filter with inline predicates and join on shared captures.

    Rules

    • rule and run. A rule fires once per combination of matching facts, and again when a captured value changes or its conditions stop holding and hold again.
    • Conditions: *none*, *some*, *every* and *either*. A condition marked *persist* never makes the rule fire again when it stops holding and holds again.
    • A rule's predicates and actions only see their own captures, not the caller's or global variables.

    Interactive shell

    • A REPL with tklips> and ...> prompts, line editing and history. It keeps going after errors; Ctrl-C drops the current form and Ctrl-D ends the session.

    SHA-256

    4dccb6077b6e822f9d1d323b9e4918da3f3943ff9e65f1fbca78140ae48aaa1a  tklips-v0.1.0-linux-x86_64
    
    Downloads