A complete, standalone programming language with native observer semantics, tensor math, closures, dictionaries, error handling, and a 25-module standard library — all in a single zero-dependency C binary.
git clone https://github.com/InauguralSystems/EigenScript.git
cd EigenScript
./install.shThis builds a ~140K binary and installs it to ~/.local/bin/eigenscript.
Requires only gcc — no external dependencies.
eigenscript program.eigs # run a script
eigenscript # interactive REPL
eigenscript --version# Variables
x is 42
name is "hello"
# Functions with named parameters
define add(a, b) as:
return a + b
print of (add of [3, 4])
# String interpolation
print of f"Hello {name}, x is {x}"
# Loops
for i in range of 10:
print of i
# Lists
items is [1, 2, 3, 4, 5]
print of (len of items)
# Conditionals
if x > 0:
print of "positive"
# Dictionaries
person is {"name": "Alice", "age": 30}
print of person.name
# Closures
define make_adder(n) as:
define inner(x) as:
return x + n
return inner
add5 is make_adder of 5
print of (add5 of 10) # 15
# Error handling
try:
result is risky_operation of data
catch e:
print of f"Error: {e}"
Every value in EigenScript tracks its own change history — entropy, rate of change, stability. You don't pay for it until you ask:
loss is 100.0
loss is 80.0
loss is 65.0
loss is 55.0
what is loss # 55.0 — current value
who is loss # "loss" — variable name
when is loss # 4 — number of assignments
where is loss # entropy (information content)
why is loss # dH — rate of change (negative = improving)
how is loss # stability score (0-1)
Six interrogatives, zero cost when unused. The runtime classifies trajectories automatically:
status is report of loss # "improving"
# Loop until the runtime says the value has converged
loop while not converged:
loss is loss * 0.9
States: improving, diverging, stable, equilibrium, oscillating,
converged. Use them for convergence detection, instability alerts, or
just debugging — why is x tells you what your value is doing without
writing logging code.
The observer runs on every assignment so interrogations are always cheap. When you know a hot region won't be interrogated, opt out:
unobserved:
game.px is game.px + game.vx * DT
game.py is game.py + game.vy * DT
Inside the block, numeric assignments mutate the existing Value in
place (identity preserved) and the observer is skipped. Outside,
normal behavior resumes. ~22% faster on a mutation-heavy hot loop.
w is random_normal of [8, 32, 0.1]
h is matmul of [input, w]
h is leaky_relu of h
probs is softmax of h
Builtins: matmul, add, subtract, multiply, divide, softmax,
log_softmax, relu, leaky_relu, zeros, random_normal, shape,
numerical_grad, sgd_update, tensor_save, tensor_load.
arena_mark of null # save allocation point
# ... compute gradients, intermediates ...
arena_reset of null # reclaim all transient allocations
Bounded computation for constrained environments.
Pure EigenScript libraries under lib/:
| Module | Description |
|---|---|
lib/math.eigs |
abs, max_val, min_val, clamp, lerp, dot |
lib/list.eigs |
map, filter, reduce, reverse, zip, flatten |
lib/string.eigs |
join, repeat, pad_left |
lib/observer.eigs |
is_converged, is_stable, entropy_of, track_regimes, snapshot |
lib/tensor.eigs |
xavier_init, he_init, linear, mse_loss, cross_entropy_loss, accuracy |
lib/io.eigs |
read_lines, write_lines, read_csv, write_csv, slurp |
lib/json.eigs |
json_get, json_has, json_merge, json_from_pairs, json_pretty |
lib/test.eigs |
assert_eq, assert_near, assert_true, test_summary |
lib/format.eigs |
fmt_num, fmt_percent, fmt_bar, fmt_table, fmt_padded |
lib/sort.eigs |
sort_asc, sort_desc, sort_by, sorted_indices, unique |
lib/map.eigs |
map_new, map_get, map_set, map_has, map_keys, map_merge |
lib/functional.eigs |
chain, apply_all, complement, when, iterate, times |
lib/args.eigs |
parse_args, get_flag, get_opt, get_positional, require_opt |
lib/datetime.eigs |
now, today, timestamp, elapsed, timer_start, sleep_ms |
lib/config.eigs |
load_env_file, load_ini, config_get, env_or, config_section |
lib/set.eigs |
set_from, union, intersect, difference, is_subset, set_equal |
lib/log.eigs |
log_debug, log_info, log_warn, log_error, log_level |
lib/validate.eigs |
is_number, is_email, in_range, is_one_of, validate_all |
lib/http.eigs |
http_get, http_post_json, route_get, parse_query, json_response |
lib/queue.eigs |
enqueue, dequeue, push, pop, pq_push, pq_pop |
lib/state.eigs |
sm_new, sm_add_transition, sm_send, sm_state, sm_history |
lib/template.eigs |
render, render_file, render_each, fill |
lib/sanitize.eigs |
sanitize_text, is_garble, clean_response, check_openai |
lib/auth.eigs |
auth_login, auth_check, auth_logout, require_auth |
lib/eigen.eigs |
Meta-circular interpreter — EigenScript evaluator written in EigenScript |
load_file of "lib/list.eigs"
doubled is map of [[1,2,3], double]
See docs/STDLIB.md for the full library guide.
Ordered as a learning path:
eigenscript examples/hello.eigs # printing
eigenscript examples/basics.eigs # variables, functions, loops, strings
eigenscript examples/fizzbuzz.eigs # conditionals and modular arithmetic
eigenscript examples/fibonacci.eigs # recursion
eigenscript examples/sort.eigs # algorithms with list mutation
eigenscript examples/json_config.eigs # JSON data processing
eigenscript examples/stdlib_demo.eigs # standard library (map, filter, reduce)
eigenscript examples/data_pipeline.eigs # combining libraries for real work
eigenscript examples/observer.eigs # observer semantics (entropy, dH)
eigenscript examples/tensors.eigs # tensor math, gradients, SGDcd tests
./run_all_tests.sh # 437/437 (minimal build; full build adds HTTP/DB/model suites)- docs/SYNTAX.md — language reference
- docs/GRAMMAR.md — formal EBNF grammar
- docs/BUILTINS.md — 139 builtin functions (119 core + 20 extensions)
- docs/STDLIB.md — standard library guide
- docs/DIAGNOSTICS.md — error format and exit codes
make # build
make test # build and run 437 tests
make install # install to ~/.local/bin
make clean # remove build artifactsOr use the shell scripts directly: ./build.sh and ./install.sh.
The binary is a single C program with no runtime dependencies.
