Skip to main content

Synapse Language

An interpreted language for uncertainty-aware scientific computing, with built-in quantum circuit simulation and parallel blocks.

PyPI Python License

Synapse is a small language focused on a few ideas that are awkward in general-purpose languages: values that carry uncertainty and propagate it through arithmetic, simple parallel branches, and quantum circuits that run on a built-in simulator.

This is an early-stage language. The sections below describe what runs today. Larger aspirational programs (imports, control flow, functions, tensors, reasoning chains, a full quantum DSL) are kept under examples/roadmap/ as design targets and do not execute yet.

Install

pip install synapse-lang

Requires Python 3.10+. Core dependencies: numpy, scipy, sympy, matplotlib, networkx, pandas, colorama.

Runtime safety

Execution is trusted and in-process, not an operating-system security sandbox. Do not run untrusted source or context callables without external isolation. execute(..., sandbox=True), execute_program(..., sandbox=True), and --sandbox fail explicitly rather than silently executing without isolation. The default is now sandbox=False; --no-sandbox remains a compatibility flag. The older security helper classes now refuse execution. An opt-in external Docker runner is available, with tested resource and OS restrictions; it is separate from the ordinary interpreter API.

See runtime optimization and verification for AST reuse, parallel semantics, benchmark commands, and verification limits.

Usage

synapse path/to/program.syn      # run a file
synapse -c 'print(1 + 2)'        # run a snippet
synapse --repl                   # interactive REPL
synapse --version

What works today

Printing, variables, and built-in math

print("Hello from Synapse!")
x = 21
y = 21
print("x + y =", x + y)
print("sqrt(144) =", sqrt(144))
print("pi =", pi)
Hello from Synapse!
x + y = 42.0
sqrt(144) = 12.0
pi = 3.141592653589793

Built-ins include print, str, int, float, bool, len, range, abs, round, min, max, sum, sqrt, exp, log, log10, sin, cos, tan, floor, ceil, mean, std, and the constants pi and e.

Uncertainty propagation

A value declared uncertain carries an uncertainty that propagates automatically through arithmetic.

uncertain measurement = 42.3 ± 0.5
uncertain temperature = 300 ± 10
energy = measurement * temperature
print("energy =", energy)
energy = 12690.0 ± 448.808422380864

Parallel branches

parallel {
    branch dataset_1: {
        print("Processing dataset 1...")
        result_1 = 100
    }
    branch dataset_2: {
        print("Processing dataset 2...")
        result_2 = 200
    }
}
print("Combined result:", result_1 + result_2)
Processing dataset 1...
Processing dataset 2...
Combined result: 300.0

Quantum circuits on the built-in simulator

quantum circuit bell(2) {
    h(0)
    cnot(0,1)
}
run bell { shots: 256 }
{'circuit': 'bell', 'backend': None, 'shots': 256, 'counts': {'11': 124, '00': 132}, 'noise': None}

A Bell state is entangled, so measurements only ever come out 00 or 11.

Examples

Runnable examples live in examples/: hello.syn, uncertainty.syn, parallel.syn, quantum_bell.syn. Each is covered by the test suite. Aspirational examples are under examples/roadmap/.

License

Proprietary software. All rights reserved. Use, copying, modification, or distribution requires a separate written license from the copyright holder; see LICENSE. Earlier copies distributed under MIT retain their granted rights, and third-party components retain their own licenses.

Citation

@software{synapse_lang,
    title = {Synapse: an interpreted language for uncertainty-aware scientific computing},
    author = {Michael Benjamin Crowe},
    year = {2026},
    version = {2.4.1}
}

Release files for synapse-lang 2.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for synapse-lang 2.4.1
File Size Uploaded
synapse_lang-2.4.1.tar.gz 431.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for synapse-lang 2.4.1
File Interpreter ABI Platform
synapse_lang-2.4.1-py3-none-any.whl Python 3 none any Details

Total release size: 667.2 kB

Release files / synapse_lang-2.4.1.tar.gz

Download URL synapse_lang-2.4.1.tar.gz
Size 431.6 kB
Tags Source
SHA-256 checksum
How to use checksums
02448cd952f3ae84ce525fbda63e12467ca79e8ed68be426d54f98b5548019ef
BLAKE2b-256 checksum
How to use checksums
72b21d0c43414234d0b0a63af45e6dffa8d822c803299f54e9d15d21f07ccd6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / synapse_lang-2.4.1-py3-none-any.whl

Download URL synapse_lang-2.4.1-py3-none-any.whl
Size 235.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a524d7aada1ee6e979e37d16b8420202bc37ba734c530881c027562e8c5fd210
BLAKE2b-256 checksum
How to use checksums
aa2e8d8396775453371f626bc5b95c0579b566426d3df795f7460c29b612499d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

2.4.1 This release

2 release files

2.3.5

2 release files

2.3.3

1 release file

2.3.2

1 release file

2.3.1

1 release file

2.3.0

1 release file

2.2.0

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page