What is NSL?
Neural Symbolic Language (NSL) is a programming language designed from scratch to bridge the gap between symbolic reasoning and neural computation. Where other languages bolt on AI as a library, NSL makes cognitive primitives -- beliefs, observations, causal reasoning, and knowledge graphs -- first-class parts of the language.
NSL uses Python-like indentation syntax with dynamic typing, making it approachable while offering capabilities no other language has.
What Makes NSL Different
- Cognitive Primitives --
believe,observe,revise,crystallize, andmonitorare keywords, not function calls - Causal Reasoning -- Express cause-and-effect with
causes,because,triggers, andleads_to - Knowledge Graph -- Every cognitive operation populates an in-memory knowledge graph queryable with
kg.*builtins - 40 Standard Library Modules -- From
tensorandgrad(autograd) tojson,http,crypto,tokenizer,py(CPython bridge),memory(74 functions), and more - GPU Acceleration --
tensor.matmul()automatically offloads to NVIDIA tensor cores. No configuration needed - Pattern Matching --
match/givenwith literal, range, or-pattern, binding, and guard support - Concurrency --
async/await,spawn, channels withsend/receive,parallel, andrace - Two Data Formats -- NSD (text, 3-8x fewer tokens than JSON) and NCF (binary, compressed, HMAC-signed)
Quick Taste
# Variables and types
let name = "NSL"
let pi = 3.14159
let active = true
let items = [1, 2, 3, 4, 5]
let config = {host: "localhost", port: 8080}
# Procedures
:: greet(who) ->
print(f"Hello, {who}!")
greet("world")
# Lambdas and pipes
let result = items |> filter(fn(x) => x > 2) |> map(fn(x) => x * x)
print(result) # [9, 16, 25]
# Beliefs with confidence
belief weather = "sunny" confidence 0.8
observe "dark clouds approaching"
revise weather = "cloudy" confidence 0.6
# Causal reasoning
"rain" causes "wet streets"
"wet streets" causes "slow traffic"
let chain = kg.path(kg.find("rain").id, kg.find("slow traffic").id)
print(chain)
Try It Now
Head to the Playground and write your first NSL program. It runs directly in your browser via WebAssembly -- no installation needed. Or chat with Qel'zyn VI, our AI assistant that knows NSL inside and out.
