SynapseLang is a domain-specific programming language for AI, tensors, and differentiable programming.

GitHub - synapselang/synapselang: A domain-specific programming language for AI and differentiable programming.
A domain-specific programming language for AI and differentiable programming. - synapselang/synapselang

Overview

SynapseLang explores how a programming language can be designed specifically for artificial intelligence and differentiable systems, where tensors, gradients, and optimization are treated as native concepts rather than implemented through external frameworks.

The project focuses on reducing the gap between mathematical models and code by providing a language structure that reflects tensor operations, model definition, and gradient-based learning directly.

Focus

  • Language design for AI and differentiable programming.
  • First-class tensor types and operations.
  • Built-in automatic differentiation.
  • Explicit trainable parameter model.
  • Shape-aware computation and validation.

Key Concepts

  • Tensor-Native Programming: Tensors are part of the core type system, enabling direct expression of matrix operations, broadcasting, and transformations without external abstractions.
  • Built-in Automatic Differentiation: Gradient computation is integrated into the language through constructs such as grad and value_and_grad, allowing models and optimization routines to be defined without separate frameworks.
  • Explicit Parameters: Trainable values are defined using a dedicated param construct, making model state and optimization behavior clear and structured.
  • Shape Awareness: Tensor shapes are visible and can be validated, reducing runtime errors and improving correctness in model design.
  • Structured Gradients: Gradients mirror the structure of the model, supporting clearer updates and parameter management.

Architecture

SynapseLang is being developed as a language system with:

  • A formal v0 language specification (syntax, grammar, types, semantics).
  • A Python-based reference interpreter for execution and experimentation.
  • A tensor and autodiff runtime model.
  • A minimal standard library for tensor operations, math functions, and optimization.

Current Status

SynapseLang is in an early-stage development phase.

The project currently includes:

  • Language design and specification (v0).
  • Formal grammar (EBNF).
  • Python reference interpreter (proof of concept).
  • Initial examples for tensor operations and differentiation.

The focus at this stage is on validating the language model, refining syntax and semantics, and testing core concepts through implementation.

Applications

SynapseLang is intended to support:

  • Machine learning model development
  • Differentiable programming and optimization
  • Tensor-based computation workflows
  • Scientific and experimental AI systems

Roadmap

  • Expand interpreter capabilities and runtime features.
  • Improve type and shape validation.
  • Develop more complex model and training examples.
  • Explore compilation and performance optimization.
  • Define a broader standard library.