inputlayer/docs/spec at main · inputlayer/inputlayer · GitHub
Skip to content

Latest commit

 

History

History

README.md

InputLayer IQL Specification

This section contains the authoritative specification for InputLayer's IQL dialect. All claims in this documentation must match the actual implementation.

Contents

Core Language

Document Description
Syntax Complete grammar with EBNF notation
Types Value types: Int64, Float64, String, Bool, Null, Vector, VectorInt8, Timestamp, Interval
Basic Concepts Facts, relations, and atoms

Rules and Queries

Document Description
Rules Persistent (+) and session rules
Queries Query syntax and execution
Grammar Full grammar overview

Error Handling

Document Description
Errors Error codes and messages

Type System Summary

InputLayer supports 9 value types:

Type Syntax Example
Int64 Integer literals 42, -7
Float64 Decimal literals 3.14, -0.5
String Quoted strings "hello", 'world'
Bool Boolean literals true, false
Null Null value null
Vector f32 array [1.0, 2.0, 3.0]
VectorInt8 i8 array (via quantization)
Timestamp Int64 milliseconds time_now()
Interval Timestamp pair (start, end)

Quick Reference

Fact Syntax

+relation(value1, value2)     // Persistent fact
relation(value1, value2)      // Session fact
-relation(value1, value2)     // Delete fact

Rule Syntax

+derived(X, Y) <- base(X, Z), other(Z, Y)     // Persistent rule
derived(X, Y) <- base(X, Z), other(Z, Y)      // Session rule

Query Syntax

?relation(X, Y), X > 10

Aggregation Syntax

?count<X> <- relation(X, _)
?sum<Value> <- data(_, Value)
?top_k<5, Item, Score:desc> <- scores(Item, Score)

Specification Principles

  1. Authoritative: Every syntax element matches parser behavior exactly
  2. Complete: All features documented (no undocumented features)
  3. Tested: Examples are runnable and verified
  4. Accurate: Claims match implementation (session rules DO support recursion)